home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / LLIST.ZIP / LISTTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-26  |  142.8 KB  |  5,749 lines

  1. /*------------------------------------------------------------
  2. | FILE NAME: ListTest.c
  3. |
  4. | DOCUMENT: [1032.0]
  5. |
  6. | PURPOSE: To test and demonstrate the use of the 'ListList' 
  7. |          linked list system.
  8. |
  9. | DESCRIPTION: Every procedure in the 'ListList' product is 
  10. | validated using automated testing.  Known values are given 
  11. | to each procedure and tests are made for expected results.  
  12. | Test results are reported to the display and to the file 
  13. | 'ListTest.txt'.  Some tests require visual validation.
  14. |
  15. | NOTE: 
  16. |
  17. | HISTORY: 11.04.93 Created by Lee Malone
  18. ------------------------------------------------------------*/
  19.  
  20. #include <ListList.h>
  21.  
  22. Item    TestItem[1] = {  (AddressOfItem) 2,  
  23.                          (AddressOfItem) 4,  
  24.                          (AddressOfByte) 6,  
  25.                          (Pair)          8 };
  26.                          
  27. List    TestList[1] = { (AddressOfItem) 10, 
  28.                         (AddressOfItem) 12, 
  29.                         (Quad)          14, 
  30.                         (Pair)          16 };
  31. FILE    *LogFile;
  32.  
  33. typedef struct 
  34. {
  35.     AddressOfTruthProcedure    TestProcedure;
  36.     AddressOfString            NameOfProcedure;
  37. } TestRecord, *AddressOfTestRecord;
  38.  
  39. /*------------------------------------------------------------
  40. | NAME: Test_Byte
  41. |
  42. | PURPOSE: To test the 'Byte' data type.
  43. |
  44. | DESCRIPTION: Returns non-zero, if error detected.
  45. |
  46. | EXAMPLE:  
  47. |
  48. | NOTE: 
  49. |
  50. | ASSUMES: 
  51. |
  52. | HISTORY: 11.08.93 by Lee Malone
  53. |
  54. ------------------------------------------------------------*/
  55. Truth
  56. Test_Byte()
  57. {
  58.     Comparison      Result;
  59.     Byte            AByte;
  60.     Byte            ByteTable[2] = { 1, 2 };
  61.     AddressOfByte   ByteAddress;
  62.     
  63.     if(sizeof(Byte) != 1) return(1);
  64.    
  65.     Result = ByteTable[0] - 1; 
  66.         if(Result != 0) return(2);
  67.     
  68.     Result = ByteTable[1] - 2; 
  69.         if(Result != 0) return(3);
  70.     
  71.     ByteAddress = ByteTable;
  72.     Result = ByteTable[0] - *ByteAddress;
  73.         if(Result != 0) return(4);
  74.  
  75.     AByte = 250; /* a 'Byte' is unsigned */
  76.         if(AByte < 0) return(5);
  77.         
  78.     return(False);
  79. }
  80.  
  81. /*------------------------------------------------------------
  82. | NAME: Test_Pair
  83. |
  84. | PURPOSE: To test the 'Pair' data type.
  85. |
  86. | DESCRIPTION: Returns non-zero if error detected.
  87. |
  88. | EXAMPLE:  
  89. |
  90. | NOTE: 
  91. |
  92. | ASSUMES: 
  93. |
  94. | HISTORY: 11.08.93 by Lee Malone
  95. |
  96. ------------------------------------------------------------*/
  97. Truth
  98. Test_Pair()
  99. {
  100.     Comparison        Result;
  101.     Pair            APair;
  102.     Pair            PairTable[2] = { 0, 1 };
  103.     AddressOfPair    PairAddress;
  104.     
  105.     if(sizeof(Pair) != 2) return(1);
  106.     
  107.     Result = PairTable[0] - 0; 
  108.         if(Result != 0) return(2);
  109.     
  110.     Result = PairTable[1] - 1; 
  111.         if(Result != 0) return(3);
  112.     
  113.     PairAddress = PairTable;
  114.     Result = PairTable[0] - *PairAddress;
  115.         if(Result != 0) return(4);
  116.  
  117.     APair = 35000; /* a 'Pair' is unsigned */
  118.         if(APair < 0) return(5);
  119.      
  120.     return(False);
  121. }
  122.  
  123. /*------------------------------------------------------------
  124. | NAME: Test_Quad
  125. |
  126. | PURPOSE: To test the 'Quad' data type.
  127. |
  128. | DESCRIPTION: Returns non-zero if error detected.
  129. |
  130. | EXAMPLE:  
  131. |
  132. | NOTE: 
  133. |
  134. | ASSUMES: 
  135. |
  136. | HISTORY: 11.08.93 by Lee Malone
  137. |
  138. ------------------------------------------------------------*/
  139. Truth
  140. Test_Quad()
  141. {
  142.     Comparison      Result;
  143.     Quad            AQuad;
  144.     Quad            QuadTable[2] = { 0, 1 };
  145.     AddressOfQuad   QuadAddress;
  146.     
  147.     if(sizeof(Quad) != 4) return(1);
  148.  
  149.     Result = QuadTable[0] - 0; 
  150.         if(Result != 0) return(2);
  151.     
  152.     Result = QuadTable[1] - 1; 
  153.         if(Result != 0) return(3);
  154.     
  155.     QuadAddress = QuadTable;
  156.     Result = QuadTable[0] - *QuadAddress;
  157.         if(Result != 0) return(4);
  158.  
  159.     AQuad = 2200000000; /* a 'Quad' is unsigned */
  160.         if(AQuad < 0) return(5);
  161.     
  162.     return(False);
  163. }
  164.  
  165. /*------------------------------------------------------------
  166. | NAME: Test_SignedByte
  167. |
  168. | PURPOSE: To test the 'SignedByte' data type.
  169. |
  170. | DESCRIPTION: Returns non-zero if error detected.
  171. |
  172. | EXAMPLE:  
  173. |
  174. | NOTE: 
  175. |
  176. | ASSUMES: 
  177. |
  178. | HISTORY: 11.09.93 by Lee Malone
  179. |
  180. ------------------------------------------------------------*/
  181. Truth
  182. Test_SignedByte()
  183. {
  184.     Comparison            Result;
  185.     SignedByte            ASignedByte;
  186.     SignedByte            SignedByteTable[2] = { -1, 1 };
  187.     AddressOfSignedByte   ASignedByteAddress;
  188.     
  189.     if(sizeof(SignedByte) != 1) return(1);
  190.     
  191.     Result = SignedByteTable[0] + 1; 
  192.         if(Result != 0) return(2);
  193.     
  194.     Result = SignedByteTable[1] - 1; 
  195.         if(Result != 0) return(3);
  196.     
  197.     ASignedByteAddress = SignedByteTable;
  198.     Result = SignedByteTable[0] - *ASignedByteAddress;
  199.         if(Result != 0) return(4);
  200.  
  201.     ASignedByte = 250; /* A 'SignedByte' must be in the range
  202.                         * +/- 127, so '250' should be 
  203.                         * interpreted as a negative number. 
  204.                         */
  205.         if(ASignedByte > 0) return(5);
  206.    
  207.     return(False);
  208. }
  209.  
  210. /*------------------------------------------------------------
  211. | NAME: Test_SignedPair
  212. |
  213. | PURPOSE: To test the 'SignedPair' data type.
  214. |
  215. | DESCRIPTION: Returns non-zero if error detected.
  216. |
  217. | EXAMPLE:  
  218. |
  219. | NOTE: 
  220. |
  221. | ASSUMES: 
  222. |
  223. | HISTORY: 11.09.93 by Lee Malone
  224. |
  225. ------------------------------------------------------------*/
  226. Truth
  227. Test_SignedPair()
  228. {
  229.     Comparison            Result;
  230.     SignedPair            ASignedPair;
  231.     SignedPair            SignedPairTable[2] = { 0, -1 };
  232.     AddressOfSignedPair   ASignedPairAddress;
  233.     
  234.     if(sizeof(SignedPair) != 2) return(1);
  235.  
  236.     Result = SignedPairTable[0] - 0; 
  237.         if(Result != 0) return(2);
  238.     
  239.     Result = SignedPairTable[1] + 1; 
  240.         if(Result != 0) return(3);
  241.     
  242.     ASignedPairAddress = SignedPairTable;
  243.     Result = SignedPairTable[0] - *ASignedPairAddress;
  244.         if(Result != 0) return(4);
  245.  
  246.     ASignedPair = 35000; 
  247.         if(ASignedPair > 0) return(5);
  248.    
  249.     return(False);
  250. }
  251.  
  252. /*------------------------------------------------------------
  253. | NAME: Test_SignedQuad
  254. |
  255. | PURPOSE: To test the 'SignedQuad' data type.
  256. |
  257. | DESCRIPTION: Returns non-zero if error detected.
  258. |
  259. | EXAMPLE:  
  260. |
  261. | NOTE: 
  262. |
  263. | ASSUMES: 
  264. |
  265. | HISTORY: 11.09.93 by Lee Malone
  266. |
  267. ------------------------------------------------------------*/
  268. Truth
  269. Test_SignedQuad()
  270. {
  271.     Comparison            Result;
  272.     SignedQuad            ASignedQuad;
  273.     SignedQuad            SignedQuadTable[2] = { 0, -1 };
  274.     AddressOfSignedQuad   ASignedQuadAddress;
  275.     
  276.     if(sizeof(SignedQuad) != 4) return(1);
  277.  
  278.     Result = SignedQuadTable[0] - 0; 
  279.         if(Result != 0) return(2);
  280.     
  281.     Result = SignedQuadTable[1] + 1; 
  282.         if(Result != 0) return(3);
  283.     
  284.     ASignedQuadAddress = SignedQuadTable;
  285.     Result = SignedQuadTable[0] - *ASignedQuadAddress;
  286.         if(Result != 0) return(4);
  287.  
  288.     ASignedQuad = 2200000000; /* a 'SignedQuad' is signed */
  289.         if(ASignedQuad > 0) return(5);
  290.     
  291.     return(False);
  292. }
  293.  
  294. /*------------------------------------------------------------
  295. | NAME: Test_CompareBytes
  296. |
  297. | PURPOSE: To test the 'CompareBytes' procedure.
  298. |
  299. | DESCRIPTION: Returns non-zero if error detected.
  300. |
  301. | EXAMPLE:  
  302. |
  303. | NOTE: You must cast the count parameters of 'CompareBytes'
  304. |       to be a 'Quad' to avoid errors when using 'Think C'.
  305. |
  306. | ASSUMES: 
  307. |
  308. | HISTORY: 11.04.93 by Lee Malone
  309. |
  310. ------------------------------------------------------------*/
  311.  
  312. Truth
  313. Test_CompareBytes()
  314. {
  315.     Comparison  Result;
  316.     Byte        ABytes[] = { 1, 1, 1, 1 };
  317.     Byte        BBytes[] = { 1, 1, 1, 8, 1 };
  318.     Byte        CBytes[] = { 1, 1, 1, 1, 2, 1 };
  319.     
  320.     Result = CompareBytes( ABytes, (Quad) 4, BBytes, (Quad) 5 );
  321.         if(Result >= 0) return(1);
  322.     
  323.     Result = CompareBytes( ABytes, (Quad) 4, CBytes, (Quad) 6 );
  324.         if(Result >= 0) return(2);
  325.     
  326.     Result = CompareBytes( BBytes, (Quad) 5, CBytes, (Quad) 6 );
  327.         if(Result <= 0) return(3);
  328.     
  329.     return(0);
  330. }
  331.  
  332. /*------------------------------------------------------------
  333. | NAME: Test_CopyBytes
  334. |
  335. | PURPOSE: To test the 'CopyBytes' procedure.
  336. |
  337. | DESCRIPTION: Returns non-zero if error detected.
  338. |
  339. | EXAMPLE:  
  340. |
  341. | NOTE: You must cast literal count parameters to be a 'Quad' 
  342. |       to avoid errors when using 'Think C'.
  343. |
  344. | ASSUMES: 
  345. |
  346. | HISTORY: 11.10.93 by Lee Malone
  347. |
  348. ------------------------------------------------------------*/
  349. Truth
  350. Test_CopyBytes()
  351. {
  352.     Byte        ABytes[] = { 1, 2, 3, 4 };
  353.     Byte        BBytes[] = { 0, 0, 0, 0, 0, 0 };
  354.     Byte        CBytes[] = { 5, 6, 7, 8 };
  355.     
  356.     /* Copy ABytes into middle of BBytes */
  357.     CopyBytes( ABytes, &BBytes[1], (Quad) 4 );
  358.         if(BBytes[0] != 0) return(1);
  359.         if(BBytes[1] != 1) return(2);
  360.         if(BBytes[2] != 2) return(3);
  361.         if(BBytes[3] != 3) return(4);
  362.         if(BBytes[4] != 4) return(5);
  363.         if(BBytes[5] != 0) return(6);
  364.         
  365.     /* Copy CBytes into middle of BBytes */
  366.     CopyBytes( CBytes, &BBytes[1], (Quad) 4 );
  367.         if(BBytes[0] != 0) return(7);
  368.         if(BBytes[1] != 5) return(8);
  369.         if(BBytes[2] != 6) return(9);
  370.         if(BBytes[3] != 7) return(10);
  371.         if(BBytes[4] != 8) return(11);
  372.         if(BBytes[5] != 0) return(12);
  373.     
  374.     /* Copy last 4 bytes of BBytes into the first 4 */
  375.     CopyBytes( &BBytes[2], BBytes, (Quad) 4);
  376.         if(BBytes[0] != 6) return(13);
  377.         if(BBytes[1] != 7) return(14);
  378.         if(BBytes[2] != 8) return(15);
  379.         if(BBytes[3] != 0) return(16);
  380.         if(BBytes[4] != 8) return(17);
  381.         if(BBytes[5] != 0) return(18);
  382.     
  383.     /* Copy first 4 bytes of BBytes into the last 4 */
  384.     CopyBytes( BBytes, &BBytes[2], (Quad) 4);
  385.         if(BBytes[0] != 6) return(19);
  386.         if(BBytes[1] != 7) return(20);
  387.         if(BBytes[2] != 6) return(21);
  388.         if(BBytes[3] != 7) return(22);
  389.         if(BBytes[4] != 8) return(23);
  390.         if(BBytes[5] != 0) return(24);
  391.     
  392.     return(False);
  393. }
  394.  
  395. /*------------------------------------------------------------
  396. | NAME: Test_ExchangeBytes
  397. |
  398. | PURPOSE: To test the 'ExchangeBytes' procedure.
  399. |
  400. | DESCRIPTION: Returns non-zero if error detected.
  401. |
  402. | EXAMPLE:  
  403. |
  404. | NOTE: You must cast literal count parameters to be a 'Quad' 
  405. |       to avoid errors when using 'Think C'.
  406. |
  407. | ASSUMES: 
  408. |
  409. | HISTORY: 11.10.93 by Lee Malone
  410. |
  411. ------------------------------------------------------------*/
  412. Truth
  413. Test_ExchangeBytes()
  414. {
  415.     Byte        ABytes[] = { 1, 2, 3, 4 };
  416.     Byte        BBytes[] = { 5, 6, 7, 8 };
  417.     
  418.     ExchangeBytes( ABytes, BBytes, (Quad) 4 );
  419.         if(BBytes[0] != 1) return(1);
  420.         if(BBytes[1] != 2) return(2);
  421.         if(BBytes[2] != 3) return(3);
  422.         if(BBytes[3] != 4) return(4);
  423.         
  424.         if(ABytes[0] != 5) return(5);
  425.         if(ABytes[1] != 6) return(6);
  426.         if(ABytes[2] != 7) return(7);
  427.         if(ABytes[3] != 8) return(8);
  428.         
  429.     return(False);
  430. }
  431.  
  432. /*------------------------------------------------------------
  433. | NAME: Test_FillBytes
  434. |
  435. | PURPOSE: To test the 'FillBytes' procedure.
  436. |
  437. | DESCRIPTION: Returns non-zero if error detected.
  438. |
  439. | EXAMPLE:  
  440. |
  441. | NOTE: You must cast literal count parameter to be a 'Quad'
  442. |       to avoid errors.
  443. |
  444. | ASSUMES: 
  445. |
  446. | HISTORY: 11.10.93 by Lee Malone
  447. |
  448. ------------------------------------------------------------*/
  449. Truth
  450. Test_FillBytes()
  451. {
  452.     Byte    ABytes[] = { 0, 0, 0, 0 };
  453.  
  454.     FillBytes( &ABytes[1], (Quad) 2, (Pair) 1);
  455.         if(ABytes[0] != 0) return(1);
  456.         if(ABytes[1] != 1) return(2);
  457.         if(ABytes[2] != 1) return(3);
  458.         if(ABytes[3] != 0) return(4);
  459.         
  460.     return(False);
  461. }
  462.  
  463. /*------------------------------------------------------------
  464. | NAME: Test_IsMatchingBytes
  465. |
  466. | PURPOSE: To test the 'IsMatchingBytes' procedure.
  467. |
  468. | DESCRIPTION: Returns non-zero if error detected.
  469. |
  470. | EXAMPLE:  
  471. |
  472. | NOTE: You must cast literal count parameter to be a 'Quad'
  473. |       to avoid errors.
  474. |
  475. | ASSUMES: 
  476. |
  477. | HISTORY: 11.11.93 by Lee Malone
  478. |
  479. ------------------------------------------------------------*/
  480. Truth
  481. Test_IsMatchingBytes()
  482. {
  483.     Truth    Result;
  484.     Byte    ABytes[] = { 0, 0, 0, 0 };
  485.     Byte    BBytes[] = { 0, 1, 2, 3 };
  486.  
  487.     Result = IsMatchingBytes( ABytes, BBytes, (Quad) 4);
  488.         if(Result != 0) return(1);
  489.         
  490.     Result = IsMatchingBytes( ABytes, ABytes, (Quad) 4);
  491.         if(Result == 0) return(1);
  492.         
  493.     return(False);
  494. }
  495.  
  496. /*------------------------------------------------------------
  497. | NAME: Test_ReplaceBytes
  498. |
  499. | PURPOSE: To test the 'ReplaceBytes' procedure.
  500. |
  501. | DESCRIPTION: Returns non-zero if error detected.
  502. |
  503. | EXAMPLE:  
  504. |
  505. | NOTE: You must cast literal count parameter to be a 'Quad'
  506. |       to avoid errors.
  507. |
  508. | ASSUMES: 
  509. |
  510. | HISTORY: 11.11.93 by Lee Malone
  511. |
  512. ------------------------------------------------------------*/
  513. Truth
  514. Test_ReplaceBytes()
  515. {
  516.     Truth   Result;
  517.     Byte    ABytes[] = { 4, 3, 6, 1 };
  518.  
  519.     ReplaceBytes( ABytes, (Quad) 4, (Pair) 3, (Pair) 9 );
  520.     ReplaceBytes( ABytes, (Quad) 4, (Pair) 6, (Pair) 7 );
  521.         if(ABytes[0] != 4) return(1);
  522.         if(ABytes[1] != 9) return(2);
  523.         if(ABytes[2] != 7) return(3);
  524.         if(ABytes[3] != 1) return(4);
  525.         
  526.     return(False);
  527. }
  528.  
  529. /*------------------------------------------------------------
  530. | NAME: Test_AppendString
  531. |
  532. | PURPOSE: To test the 'AppendString' procedure.
  533. |
  534. | DESCRIPTION: Returns non-zero if error detected.
  535. |
  536. | EXAMPLE:  
  537. |
  538. | NOTE: 
  539. |
  540. | ASSUMES: 
  541. |
  542. | HISTORY: 11.11.93 by Lee Malone
  543. |
  544. ------------------------------------------------------------*/
  545. Truth
  546. Test_AppendString()
  547. {
  548.     Truth     Result;
  549.     String    ABytes[] = "First\0      ";
  550.     String    BBytes[] = "Last";
  551.  
  552.     AppendString( ABytes, BBytes );
  553.         if(ABytes[0] != 'F') return(1);
  554.         if(ABytes[1] != 'i') return(2);
  555.         if(ABytes[2] != 'r') return(3);
  556.         if(ABytes[3] != 's') return(4);
  557.         if(ABytes[4] != 't') return(5);
  558.         if(ABytes[5] != 'L') return(6);
  559.         if(ABytes[6] != 'a') return(7);
  560.         if(ABytes[7] != 's') return(8);
  561.         if(ABytes[8] != 't') return(9);
  562.         if(ABytes[9] != 0  ) return(10);
  563.         
  564.     return(False);
  565. }
  566.  
  567. /*------------------------------------------------------------
  568. | NAME: Test_AppendStrings
  569. |
  570. | PURPOSE: To test the 'AppendStrings' procedure.
  571. |
  572. | DESCRIPTION: Returns non-zero if error detected.
  573. |
  574. | EXAMPLE:  
  575. |
  576. | NOTE: 
  577. |
  578. | ASSUMES: 
  579. |
  580. | HISTORY: 11.11.93 by Lee Malone
  581. |
  582. ------------------------------------------------------------*/
  583. Truth
  584. Test_AppendStrings()
  585. {
  586.     Truth     Result;
  587.     String    ABytes[] = "1st\0         ";
  588.     String    BBytes[] = "2nd";
  589.     String    CBytes[] = "3rd";
  590.  
  591.     AppendStrings( ABytes, 
  592.                    BBytes, 
  593.                    CBytes, 
  594.                    (AddressOfString) 0 );
  595.                    
  596.         if(ABytes[0] != '1') return(1);
  597.         if(ABytes[1] != 's') return(2);
  598.         if(ABytes[2] != 't') return(3);
  599.         if(ABytes[3] != '2') return(4);
  600.         if(ABytes[4] != 'n') return(5);
  601.         if(ABytes[5] != 'd') return(6);
  602.         if(ABytes[6] != '3') return(7);
  603.         if(ABytes[7] != 'r') return(8);
  604.         if(ABytes[8] != 'd') return(9);
  605.         if(ABytes[9] != 0  ) return(10);
  606.         
  607.     return(False);
  608. }
  609.  
  610. /*------------------------------------------------------------
  611. | NAME: Test_CountString
  612. |
  613. | PURPOSE: To test the 'CountString' procedure.
  614. |
  615. | DESCRIPTION: Returns non-zero if error detected.
  616. |
  617. | EXAMPLE:  
  618. |
  619. | NOTE: 
  620. |
  621. | ASSUMES: 
  622. |
  623. | HISTORY: 11.11.93 by Lee Malone
  624. |
  625. ------------------------------------------------------------*/
  626. Truth
  627. Test_CountString()
  628. {
  629.     Quad    Result;
  630.     String  ABytes[] = "First";
  631.     String  BBytes[] = "Last";
  632.  
  633.     Result = CountString( ABytes );
  634.         if(Result != 5) return(1);
  635.  
  636.     Result = CountString( BBytes );
  637.         if(Result != 4) return(2);
  638.         
  639.     Result = CountString( "First" );
  640.         if(Result != 5) return(3);
  641.  
  642.     Result = CountString( "Last" );
  643.         if(Result != 4) return(4);
  644.         
  645.     return(False);
  646. }
  647.  
  648. /*------------------------------------------------------------
  649. | NAME: Test_CopyString
  650. |
  651. | PURPOSE: To test the 'CopyString' procedure.
  652. |
  653. | DESCRIPTION: Returns non-zero if error detected.
  654. |
  655. | EXAMPLE:  
  656. |
  657. | NOTE: 
  658. |
  659. | ASSUMES: 
  660. |
  661. | HISTORY: 11.11.93 by Lee Malone
  662. |
  663. ------------------------------------------------------------*/
  664. Truth
  665. Test_CopyString()
  666. {
  667.     String    AString[] = "abc";
  668.     String    BString[] = ".....";
  669.     
  670.     /* Copy AString into middle of BString */
  671.     CopyString( AString, &BString[1] );
  672.         if(BString[0] != '.') return(1);
  673.         if(BString[1] != 'a') return(2);
  674.         if(BString[2] != 'b') return(3);
  675.         if(BString[3] != 'c') return(4);
  676.         if(BString[4] !=  0 ) return(5);
  677.             
  678.     return(False);
  679. }
  680.  
  681. /*------------------------------------------------------------
  682. | NAME: Test_CompareStrings
  683. |
  684. | PURPOSE: To test the 'CompareStrings' procedure.
  685. |
  686. | DESCRIPTION: Returns non-zero if error detected.
  687. |
  688. | EXAMPLE:  
  689. |
  690. | NOTE: 
  691. |
  692. | ASSUMES: 
  693. |
  694. | HISTORY: 11.11.93 by Lee Malone
  695. |
  696. ------------------------------------------------------------*/
  697. Truth
  698. Test_CompareStrings()
  699. {
  700.     Comparison    Result;
  701.     
  702.     
  703.     Result = CompareStrings( "abc", "ABC" );
  704.         if(Result != 0) return(1);
  705.             
  706.     Result = CompareStrings( "abc", "ACC" );
  707.         if(Result >= 0) return(2);
  708.             
  709.     Result = CompareStrings( "abc", "ABCD" );
  710.         if(Result >= 0) return(3);
  711.             
  712.     Result = CompareStrings( "ABCD", "abc" );
  713.         if(Result < 0) return(4);
  714.             
  715.     return(False);
  716. }
  717.  
  718. /*------------------------------------------------------------
  719. | NAME: Test_ConvertStringToLowerCase
  720. |
  721. | PURPOSE: To test the 'ConvertStringToLowerCase' procedure.
  722. |
  723. | DESCRIPTION: Returns non-zero if error detected.
  724. |
  725. | EXAMPLE:  
  726. |
  727. | NOTE: 
  728. |
  729. | ASSUMES: 
  730. |
  731. | HISTORY: 11.11.93 by Lee Malone
  732. |
  733. ------------------------------------------------------------*/
  734. Truth
  735. Test_ConvertStringToLowerCase()
  736. {
  737.     String    AString[] = "123ABC";
  738.     
  739.     ConvertStringToLowerCase( AString );
  740.         if(AString[0] != '1') return(1);
  741.         if(AString[1] != '2') return(2);
  742.         if(AString[2] != '3') return(3);
  743.         if(AString[3] != 'a') return(4);
  744.         if(AString[4] != 'b') return(5);
  745.         if(AString[5] != 'c') return(6);
  746.             
  747.     return(False);
  748. }
  749.  
  750. /*------------------------------------------------------------
  751. | NAME: Test_ConvertStringToUpperCase
  752. |
  753. | PURPOSE: To test the 'ConvertStringToUpperCase' procedure.
  754. |
  755. | DESCRIPTION: Returns non-zero if error detected.
  756. |
  757. | EXAMPLE:  
  758. |
  759. | NOTE: 
  760. |
  761. | ASSUMES: 
  762. |
  763. | HISTORY: 11.11.93 by Lee Malone
  764. |
  765. ------------------------------------------------------------*/
  766. Truth
  767. Test_ConvertStringToUpperCase()
  768. {
  769.     String    AString[] = "123abc";
  770.     
  771.     ConvertStringToUpperCase( AString );
  772.         if(AString[0] != '1') return(1);
  773.         if(AString[1] != '2') return(2);
  774.         if(AString[2] != '3') return(3);
  775.         if(AString[3] != 'A') return(4);
  776.         if(AString[4] != 'B') return(5);
  777.         if(AString[5] != 'C') return(6);
  778.             
  779.     return(False);
  780. }
  781.  
  782. /*------------------------------------------------------------
  783. | NAME: Test_FindLastByteInString
  784. |
  785. | PURPOSE: To test the 'FindLastByteInString' procedure.
  786. |
  787. | DESCRIPTION: Returns non-zero if error detected.
  788. |
  789. | EXAMPLE:  
  790. |
  791. | NOTE: 
  792. |
  793. | ASSUMES: 
  794. |
  795. | HISTORY: 11.11.93 by Lee Malone
  796. |
  797. ------------------------------------------------------------*/
  798. Truth
  799. Test_FindLastByteInString()
  800. {
  801.     String    AString[] = "123abc";
  802.     String    BString[] = "\0";
  803.     
  804.     AddressOfString    LastByte;
  805.     
  806.     LastByte = FindLastByteInString( AString );
  807.         if(LastByte != &AString[5]) return(1);
  808.             
  809.     LastByte = FindLastByteInString( BString );
  810.         if(LastByte != &BString[-1]) return(2);
  811.             
  812.     return(False);
  813. }
  814.  
  815. /*------------------------------------------------------------
  816. | NAME: Test_InsertString
  817. |
  818. | PURPOSE: To test the 'InsertString' procedure.
  819. |
  820. | DESCRIPTION: Returns non-zero if error detected.
  821. |
  822. | EXAMPLE:  
  823. |
  824. | NOTE: 
  825. |
  826. | ASSUMES: 
  827. |
  828. | HISTORY: 11.11.93 by Lee Malone
  829. |
  830. ------------------------------------------------------------*/
  831. Truth
  832. Test_InsertString()
  833. {
  834.     String    AString[] = "AA.\0       ";
  835.     String    BString[] = " is ";
  836.     
  837.     AddressOfString    LastByte;
  838.     
  839.     InsertString( BString, AString, (Quad) 1 );
  840.         if(AString[0] != 'A') return(1);
  841.         if(AString[1] != ' ') return(2);
  842.         if(AString[2] != 'i') return(3);
  843.         if(AString[3] != 's') return(4);
  844.         if(AString[4] != ' ') return(5);
  845.         if(AString[5] != 'A') return(6);
  846.         if(AString[6] != '.') return(7);
  847.             
  848.     return(False);
  849. }
  850.  
  851. /*------------------------------------------------------------
  852. | NAME: Test_ReplaceByteInString
  853. |
  854. | PURPOSE: To test the 'ReplaceByteInString' procedure.
  855. |
  856. | DESCRIPTION: Returns non-zero if error detected.
  857. |
  858. | EXAMPLE:  
  859. |
  860. | NOTE: 'Pair' used as parameter instead of 'Byte' because
  861. |       Think C can't pass 'Byte' parameters properly. See
  862. |       'DataSize.h' for more. 
  863. |
  864. | ASSUMES: 
  865. |
  866. | HISTORY: 11.11.93 by Lee Malone
  867. |
  868. ------------------------------------------------------------*/
  869. Truth
  870. Test_ReplaceByteInString()
  871. {
  872.     Truth     Result;
  873.     String    AString[] = "A is B.";
  874.  
  875.     ReplaceBytesInString( AString, (Pair) 'B', (Pair) 'A' );
  876.         if(AString[0] != 'A') return(1);
  877.         if(AString[1] != ' ') return(2);
  878.         if(AString[2] != 'i') return(3);
  879.         if(AString[3] != 's') return(4);
  880.         if(AString[4] != ' ') return(5);
  881.         if(AString[5] != 'A') return(6);
  882.         if(AString[6] != '.') return(7);
  883.         
  884.     return(False);
  885. }
  886.  
  887. /*------------------------------------------------------------
  888. | NAME: Test_GetNextItem
  889. |
  890. | PURPOSE: To test the 'GetNextItem' procedure.
  891. |
  892. | DESCRIPTION: Returns non-zero if error detected.
  893. |
  894. | EXAMPLE:  
  895. |
  896. | NOTE: 
  897. |
  898. | ASSUMES: A specific order of fields within an ItemRecord.
  899. |
  900. | HISTORY: 11.11.93 by Lee Malone
  901. |
  902. ------------------------------------------------------------*/
  903. Truth
  904. Test_GetNextItem()
  905. {
  906.     AddressOfItem    AnItem;
  907.  
  908.     AnItem = GetNextItem(TestItem);
  909.     
  910.         if(AnItem != (AddressOfItem) 2) return(1);
  911.         
  912.     return(False);
  913. }
  914.  
  915. /*------------------------------------------------------------
  916. | NAME: Test_PutNextItem
  917. |
  918. | PURPOSE: To test the 'PutNextItem' procedure.
  919. |
  920. | DESCRIPTION: Returns non-zero if error detected.
  921. |
  922. | EXAMPLE:  
  923. |
  924. | NOTE: 
  925. |
  926. | ASSUMES: 
  927. |
  928. | HISTORY: 11.16.93 by Lee Malone
  929. |
  930. ------------------------------------------------------------*/
  931. Truth
  932. Test_PutNextItem()
  933. {
  934.     AddressOfItem    AnItem;
  935.  
  936.     PutNextItem(TestItem,(AddressOfItem) 20);
  937.     AnItem = GetNextItem(TestItem);
  938.     
  939.         if(AnItem != (AddressOfItem) 20) return(1);
  940.         
  941.     return(False);
  942. }
  943.  
  944. /*------------------------------------------------------------
  945. | NAME: Test_TheNextItem
  946. |
  947. | PURPOSE: To test the 'TheNextItem' reference macro.
  948. |
  949. | DESCRIPTION: Returns non-zero if error detected.
  950. |
  951. | EXAMPLE:  
  952. |
  953. | NOTE: 
  954. |
  955. | ASSUMES: 
  956. |
  957. | HISTORY: 11.16.93 by Lee Malone
  958. |
  959. ------------------------------------------------------------*/
  960. Truth
  961. Test_TheNextItem()
  962. {
  963.     AddressOfItem    AnItem;
  964.     
  965.     TheItem = TestItem;
  966.     
  967.         if(TheNextItem != GetNextItem(TestItem)) return(1);
  968.         
  969.     TheNextItem = (AddressOfItem) 44;
  970.         if(GetNextItem(TestItem) != (AddressOfItem) 44) return(2);
  971.     
  972.     return(False);
  973. }
  974.  
  975. /*------------------------------------------------------------
  976. | NAME: Test_GetPriorItem
  977. |
  978. | PURPOSE: To test the 'GetPriorItem' procedure.
  979. |
  980. | DESCRIPTION: Returns non-zero if error detected.
  981. |
  982. | EXAMPLE:  
  983. |
  984. | NOTE: 
  985. |
  986. | ASSUMES: A specific order of fields within an ItemRecord.
  987. |
  988. | HISTORY: 11.11.93 by Lee Malone
  989. |
  990. ------------------------------------------------------------*/
  991. Truth
  992. Test_GetPriorItem()
  993. {
  994.     AddressOfItem    AnItem;
  995.  
  996.     AnItem = GetPriorItem(TestItem);
  997.     
  998.         if(AnItem != (AddressOfItem) 4) return(1);
  999.         
  1000.     return(False);
  1001. }
  1002.  
  1003. /*------------------------------------------------------------
  1004. | NAME: Test_PutPriorItem
  1005. |
  1006. | PURPOSE: To test the 'PutPriorItem' procedure.
  1007. |
  1008. | DESCRIPTION: Returns non-zero if error detected.
  1009. |
  1010. | EXAMPLE:  
  1011. |
  1012. | NOTE: 
  1013. |
  1014. | ASSUMES: 
  1015. |
  1016. | HISTORY: 11.16.93 by Lee Malone
  1017. |
  1018. ------------------------------------------------------------*/
  1019. Truth
  1020. Test_PutPriorItem()
  1021. {
  1022.     AddressOfItem    AnItem;
  1023.  
  1024.     PutPriorItem(TestItem,(AddressOfItem) 22);
  1025.     AnItem = GetPriorItem(TestItem);
  1026.     
  1027.         if(AnItem != (AddressOfItem) 22) return(1);
  1028.         
  1029.     return(False);
  1030. }
  1031.  
  1032. /*------------------------------------------------------------
  1033. | NAME: Test_ThePriorItem
  1034. |
  1035. | PURPOSE: To test the 'ThePriorItem' reference macro.
  1036. |
  1037. | DESCRIPTION: Returns non-zero if error detected.
  1038. |
  1039. | EXAMPLE:  
  1040. |
  1041. | NOTE: 
  1042. |
  1043. | ASSUMES: 
  1044. |
  1045. | HISTORY: 11.16.93 by Lee Malone
  1046. |
  1047. ------------------------------------------------------------*/
  1048. Truth
  1049. Test_ThePriorItem()
  1050. {
  1051.     AddressOfItem    AnItem;
  1052.     
  1053.     TheItem = TestItem;
  1054.     
  1055.         if(ThePriorItem != GetPriorItem(TestItem)) return(1);
  1056.         
  1057.     ThePriorItem = (AddressOfItem) 46;
  1058.         if(GetPriorItem(TestItem) != (AddressOfItem) 46) return(2);
  1059.     
  1060.     return(False);
  1061. }
  1062.  
  1063. /*------------------------------------------------------------
  1064. | NAME: Test_GetItemDataAddress
  1065. |
  1066. | PURPOSE: To test the 'GetItemDataAddress' procedure.
  1067. |
  1068. | DESCRIPTION: Returns non-zero if error detected.
  1069. |
  1070. | EXAMPLE:  
  1071. |
  1072. | NOTE: 
  1073. |
  1074. | ASSUMES: A specific order of fields within an ItemRecord.
  1075. |
  1076. | HISTORY: 11.11.93 by Lee Malone
  1077. |
  1078. ------------------------------------------------------------*/
  1079. Truth
  1080. Test_GetItemDataAddress()
  1081. {
  1082.     AddressOfByte    SomeData;
  1083.  
  1084.     SomeData = GetItemDataAddress(TestItem);
  1085.     
  1086.         if(SomeData != (AddressOfByte) 6) return(1);
  1087.         
  1088.     return(False);
  1089. }
  1090.  
  1091. /*------------------------------------------------------------
  1092. | NAME: Test_PutItemDataAddress
  1093. |
  1094. | PURPOSE: To test the 'PutItemDataAddress' procedure.
  1095. |
  1096. | DESCRIPTION: Returns non-zero if error detected.
  1097. |
  1098. | EXAMPLE:  
  1099. |
  1100. | NOTE: 
  1101. |
  1102. | ASSUMES: 
  1103. |
  1104. | HISTORY: 11.16.93 by Lee Malone
  1105. |
  1106. ------------------------------------------------------------*/
  1107. Truth
  1108. Test_PutItemDataAddress()
  1109. {
  1110.     AddressOfByte    SomeData;
  1111.  
  1112.     PutItemDataAddress(TestItem,(AddressOfByte) 24);
  1113.     SomeData = GetItemDataAddress(TestItem);
  1114.     
  1115.         if(SomeData != (AddressOfByte) 24) return(1);
  1116.         
  1117.     return(False);
  1118. }
  1119.  
  1120. /*------------------------------------------------------------
  1121. | NAME: Test_TheDataAddress
  1122. |
  1123. | PURPOSE: To test the 'TheDataAddress' reference macro.
  1124. |
  1125. | DESCRIPTION: Returns non-zero if error detected.
  1126. |
  1127. | EXAMPLE:  
  1128. |
  1129. | NOTE: 
  1130. |
  1131. | ASSUMES: 
  1132. |
  1133. | HISTORY: 11.16.93 by Lee Malone
  1134. |
  1135. ------------------------------------------------------------*/
  1136. Truth
  1137. Test_TheDataAddress()
  1138. {
  1139.     TheItem = TestItem;
  1140.     
  1141.         if(TheDataAddress != GetItemDataAddress(TestItem)) 
  1142.             return(1);
  1143.         
  1144.     TheDataAddress = (AddressOfByte) 33;
  1145.         if(GetItemDataAddress(TestItem) != (AddressOfByte) 33) 
  1146.             return(2);
  1147.     
  1148.     return(False);
  1149. }
  1150.  
  1151. /*------------------------------------------------------------
  1152. | NAME: Test_GetItemMark
  1153. |
  1154. | PURPOSE: To test the 'GetItemMark' procedure.
  1155. |
  1156. | DESCRIPTION: Returns non-zero if error detected.
  1157. |
  1158. | EXAMPLE:  
  1159. |
  1160. | NOTE: 
  1161. |
  1162. | ASSUMES: A specific order of fields within an ItemRecord.
  1163. |
  1164. | HISTORY: 11.11.93 by Lee Malone
  1165. |
  1166. ------------------------------------------------------------*/
  1167. Truth
  1168. Test_GetItemMark()
  1169. {
  1170.     Pair    AMark;
  1171.  
  1172.     AMark = GetItemMark(TestItem);
  1173.     
  1174.         if(AMark != (Pair) 8) return(1);
  1175.         
  1176.     return(False);
  1177. }
  1178.  
  1179. /*------------------------------------------------------------
  1180. | NAME: Test_PutItemMark
  1181. |
  1182. | PURPOSE: To test the 'PutItemMark' procedure.
  1183. |
  1184. | DESCRIPTION: Returns non-zero if error detected.
  1185. |
  1186. | EXAMPLE:  
  1187. |
  1188. | NOTE: 
  1189. |
  1190. | ASSUMES: 
  1191. |
  1192. | HISTORY: 11.16.93 by Lee Malone
  1193. |
  1194. ------------------------------------------------------------*/
  1195. Truth
  1196. Test_PutItemMark()
  1197. {
  1198.     Pair    AMark;
  1199.  
  1200.     PutItemMark(TestItem,(Pair) 13);
  1201.     AMark = GetItemMark(TestItem);
  1202.     
  1203.         if(AMark != (Pair) 13) return(1);
  1204.         
  1205.     return(False);
  1206. }
  1207.  
  1208. /*------------------------------------------------------------
  1209. | NAME: Test_TheItemMark
  1210. |
  1211. | PURPOSE: To test the 'TheItemMark' reference macro.
  1212. |
  1213. | DESCRIPTION: Returns non-zero if error detected.
  1214. |
  1215. | EXAMPLE:  
  1216. |
  1217. | NOTE: 
  1218. |
  1219. | ASSUMES: 
  1220. |
  1221. | HISTORY: 11.16.93 by Lee Malone
  1222. |
  1223. ------------------------------------------------------------*/
  1224. Truth
  1225. Test_TheItemMark()
  1226. {
  1227.     TheItem = TestItem;
  1228.     
  1229.         if(TheItemMark != GetItemMark(TestItem)) return(1);
  1230.         
  1231.     TheItemMark = (Pair) Marked;
  1232.         if(GetItemMark(TestItem) != (Pair) Marked) return(2);
  1233.     
  1234.     return(False);
  1235. }
  1236.  
  1237. /*------------------------------------------------------------
  1238. | NAME: Test_GetFirstItemOfList
  1239. |
  1240. | PURPOSE: To test the 'GetFirstItemOfList' procedure.
  1241. |
  1242. | DESCRIPTION: Returns non-zero if error detected.
  1243. |
  1244. | EXAMPLE:  
  1245. |
  1246. | NOTE: 
  1247. |
  1248. | ASSUMES: A specific order of fields within an ItemRecord.
  1249. |
  1250. | HISTORY: 11.11.93 by Lee Malone
  1251. |
  1252. ------------------------------------------------------------*/
  1253. Truth
  1254. Test_GetFirstItemOfList()
  1255. {
  1256.     AddressOfItem    AnItem;
  1257.  
  1258.     AnItem = GetFirstItemOfList(TestList);
  1259.     
  1260.         if(AnItem != (AddressOfItem) 10) return(1);
  1261.         
  1262.     return(False);
  1263. }
  1264.  
  1265. /*------------------------------------------------------------
  1266. | NAME: Test_PutFirstItemOfList
  1267. |
  1268. | PURPOSE: To test the 'PutFirstItemOfList' procedure.
  1269. |
  1270. | DESCRIPTION: Returns non-zero if error detected.
  1271. |
  1272. | EXAMPLE:  
  1273. |
  1274. | NOTE: 
  1275. |
  1276. | ASSUMES: 
  1277. |
  1278. | HISTORY: 11.16.93 by Lee Malone
  1279. |
  1280. ------------------------------------------------------------*/
  1281. Truth
  1282. Test_PutFirstItemOfList()
  1283. {
  1284.     AddressOfItem    AnItem;
  1285.  
  1286.     PutFirstItemOfList(TestList,(AddressOfItem) 24);
  1287.     
  1288.     AnItem = GetFirstItemOfList(TestList);
  1289.     
  1290.         if(AnItem != (AddressOfItem) 24) return(1);
  1291.         
  1292.     return(False);
  1293. }
  1294.  
  1295. /*------------------------------------------------------------
  1296. | NAME: Test_TheFirstItem
  1297. |
  1298. | PURPOSE: To test the 'TheFirstItem' reference macro.
  1299. |
  1300. | DESCRIPTION: Returns non-zero if error detected.
  1301. |
  1302. | EXAMPLE:  
  1303. |
  1304. | NOTE: 
  1305. |
  1306. | ASSUMES: 
  1307. |
  1308. | HISTORY: 11.16.93 by Lee Malone
  1309. |
  1310. ------------------------------------------------------------*/
  1311. Truth
  1312. Test_TheFirstItem()
  1313. {
  1314.     TheList = TestList;
  1315.     
  1316.         if(TheFirstItem != GetFirstItemOfList(TestList)) 
  1317.             return(1);
  1318.         
  1319.     TheFirstItem = (AddressOfItem) 888;
  1320.         if(GetFirstItemOfList(TestList) != 
  1321.            (AddressOfItem) 888) return(2);
  1322.     
  1323.     return(False);
  1324. }
  1325.  
  1326. /*------------------------------------------------------------
  1327. | NAME: Test_GetLastItemOfList
  1328. |
  1329. | PURPOSE: To test the 'GetLastItemOfList' procedure.
  1330. |
  1331. | DESCRIPTION: Returns non-zero if error detected.
  1332. |
  1333. | EXAMPLE:  
  1334. |
  1335. | NOTE: 
  1336. |
  1337. | ASSUMES: A specific order of fields within an ItemRecord.
  1338. |
  1339. | HISTORY: 11.11.93 by Lee Malone
  1340. |
  1341. ------------------------------------------------------------*/
  1342. Truth
  1343. Test_GetLastItemOfList()
  1344. {
  1345.     AddressOfItem    AnItem;
  1346.  
  1347.     AnItem = GetLastItemOfList(TestList);
  1348.     
  1349.         if(AnItem != (AddressOfItem) 12) return(1);
  1350.         
  1351.     return(False);
  1352. }
  1353.  
  1354. /*------------------------------------------------------------
  1355. | NAME: Test_PutLastItemOfList
  1356. |
  1357. | PURPOSE: To test the 'PutLastItemOfList' procedure.
  1358. |
  1359. | DESCRIPTION: Returns non-zero if error detected.
  1360. |
  1361. | EXAMPLE:  
  1362. |
  1363. | NOTE: 
  1364. |
  1365. | ASSUMES: 
  1366. |
  1367. | HISTORY: 11.16.93 by Lee Malone
  1368. |
  1369. ------------------------------------------------------------*/
  1370. Truth
  1371. Test_PutLastItemOfList()
  1372. {
  1373.     AddressOfItem    AnItem;
  1374.  
  1375.     PutLastItemOfList(TestList,(AddressOfItem) 26);
  1376.     
  1377.     AnItem = GetLastItemOfList(TestList);
  1378.     
  1379.         if(AnItem != (AddressOfItem) 26) return(1);
  1380.         
  1381.     return(False);
  1382. }
  1383.  
  1384. /*------------------------------------------------------------
  1385. | NAME: Test_TheLastItem
  1386. |
  1387. | PURPOSE: To test the 'TheLastItem' reference macro.
  1388. |
  1389. | DESCRIPTION: Returns non-zero if error detected.
  1390. |
  1391. | EXAMPLE:  
  1392. |
  1393. | NOTE: 
  1394. |
  1395. | ASSUMES: 
  1396. |
  1397. | HISTORY: 11.16.93 by Lee Malone
  1398. |
  1399. ------------------------------------------------------------*/
  1400. Truth
  1401. Test_TheLastItem()
  1402. {
  1403.     TheList = TestList;
  1404.     
  1405.         if(TheLastItem != GetLastItemOfList(TestList)) 
  1406.             return(1);
  1407.         
  1408.     TheLastItem = (AddressOfItem) 890;
  1409.         if(GetLastItemOfList(TestList) != 
  1410.            (AddressOfItem) 890) return(2);
  1411.     
  1412.     return(False);
  1413. }
  1414.  
  1415. /*------------------------------------------------------------
  1416. | NAME: Test_GetListItemCount
  1417. |
  1418. | PURPOSE: To test the 'GetListItemCount' procedure.
  1419. |
  1420. | DESCRIPTION: Returns non-zero if error detected.
  1421. |
  1422. | EXAMPLE:  
  1423. |
  1424. | NOTE: 
  1425. |
  1426. | ASSUMES: A specific order of fields within an ItemRecord.
  1427. |
  1428. | HISTORY: 11.11.93 by Lee Malone
  1429. |
  1430. ------------------------------------------------------------*/
  1431. Truth
  1432. Test_GetListItemCount()
  1433. {
  1434.     Quad    ACount;
  1435.  
  1436.     ACount = GetListItemCount(TestList);
  1437.     
  1438.         if(ACount != (Quad) 14) return(1);
  1439.         
  1440.     return(False);
  1441. }
  1442.  
  1443. /*------------------------------------------------------------
  1444. | NAME: Test_PutListItemCount
  1445. |
  1446. | PURPOSE: To test the 'PutListItemCount' procedure.
  1447. |
  1448. | DESCRIPTION: Returns non-zero if error detected.
  1449. |
  1450. | EXAMPLE:  
  1451. |
  1452. | NOTE: 
  1453. |
  1454. | ASSUMES: 
  1455. |
  1456. | HISTORY: 11.16.93 by Lee Malone
  1457. |
  1458. ------------------------------------------------------------*/
  1459. Truth
  1460. Test_PutListItemCount()
  1461. {
  1462.     Quad    ACount;
  1463.  
  1464.     PutListItemCount(TestList,(Quad) 17);
  1465.     
  1466.     ACount = GetListItemCount(TestList);
  1467.     
  1468.         if(ACount != (Quad) 17) return(1);
  1469.         
  1470.     return(False);
  1471. }
  1472.  
  1473. /*------------------------------------------------------------
  1474. | NAME: Test_TheItemCount
  1475. |
  1476. | PURPOSE: To test the 'TheItemCount' reference macro.
  1477. |
  1478. | DESCRIPTION: Returns non-zero if error detected.
  1479. |
  1480. | EXAMPLE:  
  1481. |
  1482. | NOTE: 
  1483. |
  1484. | ASSUMES: 
  1485. |
  1486. | HISTORY: 11.16.93 by Lee Malone
  1487. |
  1488. ------------------------------------------------------------*/
  1489. Truth
  1490. Test_TheItemCount()
  1491. {
  1492.     TheList = TestList;
  1493.     
  1494.         if(TheItemCount != GetListItemCount(TestList)) 
  1495.             return(1);
  1496.         
  1497.     TheItemCount = (Quad) 123;
  1498.         if(GetListItemCount(TestList) != (Quad) 123) 
  1499.             return(2);
  1500.     
  1501.     return(False);
  1502. }
  1503.  
  1504. /*------------------------------------------------------------
  1505. | NAME: Test_GetListMark
  1506. |
  1507. | PURPOSE: To test the 'GetListMark' procedure.
  1508. |
  1509. | DESCRIPTION: Returns non-zero if error detected.
  1510. |
  1511. | EXAMPLE:  
  1512. |
  1513. | NOTE: 
  1514. |
  1515. | ASSUMES: A specific order of fields within an ItemRecord.
  1516. |
  1517. | HISTORY: 11.11.93 by Lee Malone
  1518. |
  1519. ------------------------------------------------------------*/
  1520. Truth
  1521. Test_GetListMark()
  1522. {
  1523.     Pair    AMark;
  1524.  
  1525.     AMark = GetListMark(TestList);
  1526.     
  1527.         if(AMark != (Pair) 16) return(1);
  1528.         
  1529.     return(False);
  1530. }
  1531.  
  1532. /*------------------------------------------------------------
  1533. | NAME: Test_PutListMark
  1534. |
  1535. | PURPOSE: To test the 'PutListMark' procedure.
  1536. |
  1537. | DESCRIPTION: Returns non-zero if error detected.
  1538. |
  1539. | EXAMPLE:  
  1540. |
  1541. | NOTE: 
  1542. |
  1543. | ASSUMES: 
  1544. |
  1545. | HISTORY: 11.16.93 by Lee Malone
  1546. |
  1547. ------------------------------------------------------------*/
  1548. Truth
  1549. Test_PutListMark()
  1550. {
  1551.     Pair    AMark;
  1552.  
  1553.     PutListMark(TestList,(Pair) 19);
  1554.     
  1555.     AMark = GetListMark(TestList);
  1556.     
  1557.         if(AMark != (Pair) 19) return(1);
  1558.         
  1559.     return(False);
  1560. }
  1561.  
  1562. /*------------------------------------------------------------
  1563. | NAME: Test_TheListMark
  1564. |
  1565. | PURPOSE: To test the 'TheListMark' reference macro.
  1566. |
  1567. | DESCRIPTION: Returns non-zero if error detected.
  1568. |
  1569. | EXAMPLE:  
  1570. |
  1571. | NOTE: 
  1572. |
  1573. | ASSUMES: 
  1574. |
  1575. | HISTORY: 11.16.93 by Lee Malone
  1576. |
  1577. ------------------------------------------------------------*/
  1578. Truth
  1579. Test_TheListMark()
  1580. {
  1581.     TheList = TestList;
  1582.     
  1583.         if(TheListMark != GetListMark(TestList)) 
  1584.             return(1);
  1585.         
  1586.     TheListMark = (Pair) Marked;
  1587.         if(GetListMark(TestList) != (Pair) Marked) 
  1588.             return(2);
  1589.     
  1590.     return(False);
  1591. }
  1592.  
  1593. /*------------------------------------------------------------
  1594. | NAME: Test_MarkItem
  1595. |
  1596. | PURPOSE: To test the 'MarkItem' procedure.
  1597. |
  1598. | DESCRIPTION: Returns non-zero if error detected.
  1599. |
  1600. | EXAMPLE:  
  1601. |
  1602. | NOTE: 
  1603. |
  1604. | ASSUMES: 
  1605. |
  1606. | HISTORY: 11.16.93 by Lee Malone
  1607. |
  1608. ------------------------------------------------------------*/
  1609. Truth
  1610. Test_MarkItem()
  1611. {
  1612.     Pair    AMark;
  1613.  
  1614.     PutItemMark(TestItem, (Pair) 0);
  1615.     
  1616.     MarkItem(TestItem);
  1617.     
  1618.     AMark = GetItemMark(TestItem);
  1619.     
  1620.         if(AMark != (Pair) Marked) return(1);
  1621.         
  1622.     return(False);
  1623. }
  1624.  
  1625. /*------------------------------------------------------------
  1626. | NAME: Test_UnMarkItem
  1627. |
  1628. | PURPOSE: To test the 'UnMarkItem' procedure.
  1629. |
  1630. | DESCRIPTION: Returns non-zero if error detected.
  1631. |
  1632. | EXAMPLE:  
  1633. |
  1634. | NOTE: 
  1635. |
  1636. | ASSUMES: 
  1637. |
  1638. | HISTORY: 11.16.93 by Lee Malone
  1639. |
  1640. ------------------------------------------------------------*/
  1641. Truth
  1642. Test_UnMarkItem()
  1643. {
  1644.     Pair    AMark;
  1645.  
  1646.     PutItemMark(TestItem, (Pair) Marked);
  1647.     
  1648.     UnMarkItem(TestItem);
  1649.     
  1650.     AMark = GetItemMark(TestItem);
  1651.     
  1652.         if(AMark == (Pair) Marked) return(1);
  1653.         
  1654.     return(False);
  1655. }
  1656.  
  1657.  
  1658. /*------------------------------------------------------------
  1659. | NAME: Test_IsItemMarked
  1660. |
  1661. | PURPOSE: To test the 'IsItemMarked' procedure.
  1662. |
  1663. | DESCRIPTION: Returns non-zero if error detected.
  1664. |
  1665. | EXAMPLE:  
  1666. |
  1667. | NOTE: 
  1668. |
  1669. | ASSUMES: 
  1670. |
  1671. | HISTORY: 11.16.93 by Lee Malone
  1672. |
  1673. ------------------------------------------------------------*/
  1674. Truth
  1675. Test_IsItemMarked()
  1676. {
  1677.     Pair    AMark;
  1678.  
  1679.     MarkItem(TestItem);
  1680.     
  1681.         if(!IsItemMarked(TestItem)) return(1);
  1682.         
  1683.     UnMarkItem(TestItem);
  1684.     
  1685.         if(IsItemMarked(TestItem)) return(2);
  1686.         
  1687.     return(False);
  1688. }
  1689.  
  1690. /*------------------------------------------------------------
  1691. | NAME: Test_MarkList
  1692. |
  1693. | PURPOSE: To test the 'MarkList' procedure.
  1694. |
  1695. | DESCRIPTION: Returns non-zero if error detected.
  1696. |
  1697. | EXAMPLE:  
  1698. |
  1699. | NOTE: 
  1700. |
  1701. | ASSUMES: 
  1702. |
  1703. | HISTORY: 11.16.93 by Lee Malone
  1704. |
  1705. ------------------------------------------------------------*/
  1706. Truth
  1707. Test_MarkList()
  1708. {
  1709.     Pair    AMark;
  1710.  
  1711.     PutListMark(TestList, (Pair) 0);
  1712.     
  1713.     MarkList(TestList);
  1714.     
  1715.     AMark = GetListMark(TestList);
  1716.     
  1717.         if(AMark != (Pair) Marked) return(1);
  1718.         
  1719.     return(False);
  1720. }
  1721.  
  1722. /*------------------------------------------------------------
  1723. | NAME: Test_UnMarkList
  1724. |
  1725. | PURPOSE: To test the 'UnMarkList' procedure.
  1726. |
  1727. | DESCRIPTION: Returns non-zero if error detected.
  1728. |
  1729. | EXAMPLE:  
  1730. |
  1731. | NOTE: 
  1732. |
  1733. | ASSUMES: 
  1734. |
  1735. | HISTORY: 11.16.93 by Lee Malone
  1736. |
  1737. ------------------------------------------------------------*/
  1738. Truth
  1739. Test_UnMarkList()
  1740. {
  1741.     Pair    AMark;
  1742.  
  1743.     PutListMark(TestList, (Pair) Marked);
  1744.     
  1745.     UnMarkList(TestList);
  1746.     
  1747.     AMark = GetListMark(TestList);
  1748.     
  1749.         if(AMark == (Pair) Marked) return(1);
  1750.         
  1751.     return(False);
  1752. }
  1753.  
  1754. /*------------------------------------------------------------
  1755. | NAME: Test_IsListMarked
  1756. |
  1757. | PURPOSE: To test the 'IsListMarked' procedure.
  1758. |
  1759. | DESCRIPTION: Returns non-zero if error detected.
  1760. |
  1761. | EXAMPLE:  
  1762. |
  1763. | NOTE: 
  1764. |
  1765. | ASSUMES: 
  1766. |
  1767. | HISTORY: 11.16.93 by Lee Malone
  1768. |
  1769. ------------------------------------------------------------*/
  1770. Truth
  1771. Test_IsListMarked()
  1772. {
  1773.     Pair    AMark;
  1774.  
  1775.     MarkList(TestList);
  1776.     
  1777.         if(!IsListMarked(TestList)) return(1);
  1778.         
  1779.     UnMarkList(TestList);
  1780.     
  1781.         if(IsListMarked(TestList)) return(2);
  1782.         
  1783.     return(False);
  1784. }
  1785.  
  1786. /*------------------------------------------------------------
  1787. | NAME: Test_MarkItemAsFirst
  1788. |
  1789. | PURPOSE: To test the 'MarkItemAsFirst' procedure.
  1790. |
  1791. | DESCRIPTION: Returns non-zero if error detected.
  1792. |
  1793. | EXAMPLE:  
  1794. |
  1795. | NOTE: 
  1796. |
  1797. | ASSUMES: 
  1798. |
  1799. | HISTORY: 11.16.93 by Lee Malone
  1800. |
  1801. ------------------------------------------------------------*/
  1802. Truth
  1803. Test_MarkItemAsFirst()
  1804. {
  1805.     PutPriorItem(TestItem,(AddressOfItem) 1900);
  1806.     
  1807.     MarkItemAsFirst(TestItem);
  1808.     
  1809.         if(GetPriorItem(TestItem) != (AddressOfItem) 0) 
  1810.             return(1);
  1811.  
  1812.     return(False);
  1813. }
  1814.  
  1815. /*------------------------------------------------------------
  1816. | NAME: Test_IsItemFirst
  1817. |
  1818. | PURPOSE: To test the 'IsItemFirst' procedure.
  1819. |
  1820. | DESCRIPTION: Returns non-zero if error detected.
  1821. |
  1822. | EXAMPLE:  
  1823. |
  1824. | NOTE: 
  1825. |
  1826. | ASSUMES: 
  1827. |
  1828. | HISTORY: 11.16.93 by Lee Malone
  1829. |
  1830. ------------------------------------------------------------*/
  1831. Truth
  1832. Test_IsItemFirst()
  1833. {
  1834.     
  1835.     MarkItemAsFirst(TestItem);
  1836.     
  1837.         if(!IsItemFirst(TestItem))  return(1);
  1838.  
  1839.     PutPriorItem(TestItem,(AddressOfItem) 1900);
  1840.         if(IsItemFirst(TestItem))   return(2);
  1841.  
  1842.     return(False);
  1843. }
  1844.  
  1845. /*------------------------------------------------------------
  1846. | NAME: Test_MarkItemAsFirst
  1847. |
  1848. | PURPOSE: To test the 'MarkItemAsFirst' procedure.
  1849. |
  1850. | DESCRIPTION: Returns non-zero if error detected.
  1851. |
  1852. | EXAMPLE:  
  1853. |
  1854. | NOTE: 
  1855. |
  1856. | ASSUMES: 
  1857. |
  1858. | HISTORY: 11.16.93 by Lee Malone
  1859. |
  1860. ------------------------------------------------------------*/
  1861. Truth
  1862. Test_MarkItemAsLast()
  1863. {
  1864.     PutNextItem(TestItem,(AddressOfItem) 1904);
  1865.     
  1866.     MarkItemAsLast(TestItem);
  1867.     
  1868.         if(GetNextItem(TestItem) != (AddressOfItem) 0) 
  1869.             return(1);
  1870.  
  1871.     return(False);
  1872. }
  1873.  
  1874. /*------------------------------------------------------------
  1875. | NAME: Test_IsItemLast
  1876. |
  1877. | PURPOSE: To test the 'IsItemLast' procedure.
  1878. |
  1879. | DESCRIPTION: Returns non-zero if error detected.
  1880. |
  1881. | EXAMPLE:  
  1882. |
  1883. | NOTE: 
  1884. |
  1885. | ASSUMES: 
  1886. |
  1887. | HISTORY: 11.16.93 by Lee Malone
  1888. |
  1889. ------------------------------------------------------------*/
  1890. Truth
  1891. Test_IsItemLast()
  1892. {
  1893.     
  1894.     MarkItemAsLast(TestItem);
  1895.     
  1896.         if(!IsItemLast(TestItem))  return(1);
  1897.  
  1898.     PutNextItem(TestItem,(AddressOfItem) 1902);
  1899.         if(IsItemLast(TestItem))   return(2);
  1900.  
  1901.     return(False);
  1902. }
  1903.  
  1904. /*------------------------------------------------------------
  1905. | NAME: Test_IsItemAlone
  1906. |
  1907. | PURPOSE: To test the 'IsItemAlone' procedure.
  1908. |
  1909. | DESCRIPTION: Returns non-zero if error detected.
  1910. |
  1911. | EXAMPLE:  
  1912. |
  1913. | NOTE: 
  1914. |
  1915. | ASSUMES: 
  1916. |
  1917. | HISTORY: 11.16.93 by Lee Malone
  1918. |
  1919. ------------------------------------------------------------*/
  1920. Truth
  1921. Test_IsItemAlone()
  1922. {
  1923.     
  1924.     PutNextItem(TestItem,(AddressOfItem) 1906);
  1925.         if(IsItemAlone(TestItem))  return(1);
  1926.         
  1927.     MarkItemAsLast(TestItem);
  1928.     
  1929.     PutPriorItem(TestItem,(AddressOfItem) 1908);
  1930.         if(IsItemAlone(TestItem))  return(2);
  1931.     
  1932.     MarkItemAsFirst(TestItem);
  1933.         if(!IsItemAlone(TestItem))  return(3);
  1934.  
  1935.     return(False);
  1936. }
  1937.  
  1938. /*------------------------------------------------------------
  1939. | NAME: Test_ToNextItem
  1940. |
  1941. | PURPOSE: To test the 'ToNextItem' procedure.
  1942. |
  1943. | DESCRIPTION: Returns non-zero if error detected.
  1944. |
  1945. | EXAMPLE:  
  1946. |
  1947. | NOTE: 
  1948. |
  1949. | ASSUMES: 
  1950. |
  1951. | HISTORY: 11.16.93 by Lee Malone
  1952. |
  1953. ------------------------------------------------------------*/
  1954. Truth
  1955. Test_ToNextItem()
  1956. {
  1957.     
  1958.     TheItem = TestItem;
  1959.     
  1960.     PutNextItem(TestItem,(AddressOfItem) 1908);
  1961.     
  1962.     ToNextItem();
  1963.         if(TheItem != (AddressOfItem) 1908)  return(1);
  1964.  
  1965.     return(False);
  1966. }
  1967.  
  1968. /*------------------------------------------------------------
  1969. | NAME: Test_ToPriorItem
  1970. |
  1971. | PURPOSE: To test the 'ToPriorItem' procedure.
  1972. |
  1973. | DESCRIPTION: Returns non-zero if error detected.
  1974. |
  1975. | EXAMPLE:  
  1976. |
  1977. | NOTE: 
  1978. |
  1979. | ASSUMES: 
  1980. |
  1981. | HISTORY: 11.16.93 by Lee Malone
  1982. |
  1983. ------------------------------------------------------------*/
  1984. Truth
  1985. Test_ToPriorItem()
  1986. {
  1987.     
  1988.     TheItem = TestItem;
  1989.     
  1990.     PutPriorItem(TestItem,(AddressOfItem) 1910);
  1991.     
  1992.     ToPriorItem();
  1993.         if(TheItem != (AddressOfItem) 1910)  return(1);
  1994.  
  1995.     return(False);
  1996. }
  1997.  
  1998. /*------------------------------------------------------------
  1999. | NAME: Test_ToFirstItem
  2000. |
  2001. | PURPOSE: To test the 'ToFirstItem' procedure.
  2002. |
  2003. | DESCRIPTION: Returns non-zero if error detected.
  2004. |
  2005. | EXAMPLE:  
  2006. |
  2007. | NOTE: 
  2008. |
  2009. | ASSUMES: 
  2010. |
  2011. | HISTORY: 11.16.93 by Lee Malone
  2012. |
  2013. ------------------------------------------------------------*/
  2014. Truth
  2015. Test_ToFirstItem()
  2016. {
  2017.     
  2018.     TheList = TestList;
  2019.     
  2020.     TheFirstItem = TestItem;
  2021.     TheLastItem  = (AddressOfItem) 0;
  2022.     
  2023.     TheItem = (AddressOfItem) 1912;
  2024.     
  2025.     ToFirstItem();
  2026.         if(TheItem != TestItem)  return(1);
  2027.  
  2028.     return(False);
  2029. }
  2030.  
  2031. /*------------------------------------------------------------
  2032. | NAME: Test_ToLastItem
  2033. |
  2034. | PURPOSE: To test the 'ToLastItem' procedure.
  2035. |
  2036. | DESCRIPTION: Returns non-zero if error detected.
  2037. |
  2038. | EXAMPLE:  
  2039. |
  2040. | NOTE: 
  2041. |
  2042. | ASSUMES: 
  2043. |
  2044. | HISTORY: 11.16.93 by Lee Malone
  2045. |
  2046. ------------------------------------------------------------*/
  2047. Truth
  2048. Test_ToLastItem()
  2049. {
  2050.     
  2051.     TheList = TestList;
  2052.     
  2053.     TheLastItem   = TestItem;
  2054.     TheFirstItem  = (AddressOfItem) 0;
  2055.     
  2056.     TheItem = (AddressOfItem) 1914;
  2057.     
  2058.     ToLastItem();
  2059.         if(TheItem != TestItem)  return(1);
  2060.  
  2061.     return(False);
  2062. }
  2063.  
  2064. /*------------------------------------------------------------
  2065. | NAME: Test_SetUpTheListSystem
  2066. |
  2067. | PURPOSE: To test the 'SetUpTheListSystem' procedure.
  2068. |
  2069. | DESCRIPTION: Returns non-zero if error detected.
  2070. |
  2071. | EXAMPLE:  
  2072. |
  2073. | NOTE: 
  2074. |
  2075. | ASSUMES: 
  2076. |
  2077. | HISTORY: 11.16.93 by Lee Malone
  2078. |
  2079. ------------------------------------------------------------*/
  2080. Truth
  2081. Test_SetUpTheListSystem()
  2082. {
  2083.     TheListSystemIsSetUp = False;
  2084.     
  2085.     TheListStackIndex = 10;
  2086.     MaxCountOfLists   = 0;
  2087.     MaxCountOfItems   = 0;
  2088.     ListSpace         = 0;
  2089.     ItemSpace         = 0;
  2090.     CountOfFreeItems  = 0;
  2091.     CountOfFreeLists  = 0;
  2092.     FirstFreeList     = 0;
  2093.     FirstFreeItem     = 0;
  2094.     
  2095.     SetUpTheListSystem((Quad) 30, (Quad) 100);
  2096.     
  2097.         if( TheListSystemIsSetUp == False ) return(1);
  2098.         if( TheListStackIndex != 0 )        return(2);
  2099.         if( MaxCountOfLists != 30 )         return(3);
  2100.         if( MaxCountOfItems != 100 )        return(4);
  2101.         if( ListSpace == 0 )                return(5);
  2102.         if( ItemSpace == 0 )                return(6);
  2103.         if( CountOfFreeItems != 100 )       return(7);
  2104.         if( CountOfFreeLists != 30 )        return(8);
  2105.         if( FirstFreeList != ListSpace )    return(9);
  2106.         if( FirstFreeItem != ItemSpace )    return(10);
  2107.         
  2108.     TheList = FirstFreeList;
  2109.         if(TheFirstItem != (AddressOfItem) &ListSpace[1] ) 
  2110.             return(11);
  2111.         
  2112.     TheItem = FirstFreeItem;
  2113.         if(TheNextItem != (AddressOfItem) &ItemSpace[1] )  
  2114.             return(12);
  2115.         
  2116.     return(False);
  2117. }
  2118.  
  2119. /*------------------------------------------------------------
  2120. | NAME: Test_PushTheItem
  2121. |
  2122. | PURPOSE: To test the 'PushTheItem' procedure.
  2123. |
  2124. | DESCRIPTION: Returns non-zero if error detected.
  2125. |
  2126. | EXAMPLE:  
  2127. |
  2128. | NOTE: 
  2129. |
  2130. | ASSUMES: 
  2131. |
  2132. | HISTORY: 11.16.93 by Lee Malone
  2133. |
  2134. ------------------------------------------------------------*/
  2135. Truth
  2136. Test_PushTheItem()
  2137. {
  2138.     Quad    i;
  2139.     
  2140.     TheItem = TestItem;
  2141.     i = TheListStackIndex;
  2142.     
  2143.     PushTheItem();
  2144.     
  2145.         if(TheListStackIndex != i+1) return(1);
  2146.         if(TheListStack[i+1] != (Quad) TestItem) return(2);
  2147.         
  2148.     return(False);
  2149. }
  2150.  
  2151. /*------------------------------------------------------------
  2152. | NAME: Test_PullTheItem
  2153. |
  2154. | PURPOSE: To test the 'PullTheItem' procedure.
  2155. |
  2156. | DESCRIPTION: Returns non-zero if error detected.
  2157. |
  2158. | EXAMPLE:  
  2159. |
  2160. | NOTE: 
  2161. |
  2162. | ASSUMES: 
  2163. |
  2164. | HISTORY: 11.16.93 by Lee Malone
  2165. |
  2166. ------------------------------------------------------------*/
  2167. Truth
  2168. Test_PullTheItem()
  2169. {
  2170.     Quad    i;
  2171.     
  2172.     TheItem = TestItem;
  2173.     i = TheListStackIndex;
  2174.     
  2175.     PushTheItem();
  2176.     TheItem = (AddressOfItem) 0;
  2177.     PullTheItem();
  2178.     
  2179.         if(TheListStackIndex != i) return(1);
  2180.         if(TheItem != TestItem)    return(2);
  2181.         
  2182.     return(False);
  2183. }
  2184.  
  2185. /*------------------------------------------------------------
  2186. | NAME: Test_PushTheList
  2187. |
  2188. | PURPOSE: To test the 'PushTheList' procedure.
  2189. |
  2190. | DESCRIPTION: Returns non-zero if error detected.
  2191. |
  2192. | EXAMPLE:  
  2193. |
  2194. | NOTE: 
  2195. |
  2196. | ASSUMES: 
  2197. |
  2198. | HISTORY: 11.16.93 by Lee Malone
  2199. |
  2200. ------------------------------------------------------------*/
  2201. Truth
  2202. Test_PushTheList()
  2203. {
  2204.     Quad    i;
  2205.     
  2206.     TheList = TestList;
  2207.     i = TheListStackIndex;
  2208.     
  2209.     PushTheList();
  2210.     
  2211.         if(TheListStackIndex != i+1) return(1);
  2212.         if(TheListStack[i+1] != (Quad) TestList) return(2);
  2213.         
  2214.     return(False);
  2215. }
  2216.  
  2217. /*------------------------------------------------------------
  2218. | NAME: Test_PullTheList
  2219. |
  2220. | PURPOSE: To test the 'PullTheList' procedure.
  2221. |
  2222. | DESCRIPTION: Returns non-zero if error detected.
  2223. |
  2224. | EXAMPLE:  
  2225. |
  2226. | NOTE: 
  2227. |
  2228. | ASSUMES: 
  2229. |
  2230. | HISTORY: 11.16.93 by Lee Malone
  2231. |
  2232. ------------------------------------------------------------*/
  2233. Truth
  2234. Test_PullTheList()
  2235. {
  2236.     Quad    i;
  2237.     
  2238.     TheList = TestList;
  2239.     i = TheListStackIndex;
  2240.     
  2241.     PushTheList();
  2242.     TheList = (AddressOfList) 0;
  2243.     PullTheList();
  2244.     
  2245.         if(TheListStackIndex != i) return(1);
  2246.         if(TheList != TestList)    return(2);
  2247.         
  2248.     return(False);
  2249. }
  2250.  
  2251. /*------------------------------------------------------------
  2252. | NAME: Test_PushTheListAndItem
  2253. |
  2254. | PURPOSE: To test the 'PushTheListAndItem' procedure.
  2255. |
  2256. | DESCRIPTION: Returns non-zero if error detected.
  2257. |
  2258. | EXAMPLE:  
  2259. |
  2260. | NOTE: 
  2261. |
  2262. | ASSUMES: 
  2263. |
  2264. | HISTORY: 11.16.93 by Lee Malone
  2265. |
  2266. ------------------------------------------------------------*/
  2267. Truth
  2268. Test_PushTheListAndItem()
  2269. {
  2270.     Quad    i;
  2271.     
  2272.     TheList = TestList;
  2273.     TheItem = TestItem;
  2274.     
  2275.     i = TheListStackIndex;
  2276.     
  2277.     PushTheListAndItem();
  2278.     
  2279.         if(TheListStackIndex != i+2) return(1);
  2280.         if(TheListStack[i+1] != (Quad) TestList) return(2);
  2281.         if(TheListStack[i+2] != (Quad) TestItem) return(3);
  2282.         
  2283.     return(False);
  2284. }
  2285.  
  2286. /*------------------------------------------------------------
  2287. | NAME: Test_PullTheListAndItem
  2288. |
  2289. | PURPOSE: To test the 'PullTheListAndItem' procedure.
  2290. |
  2291. | DESCRIPTION: Returns non-zero if error detected.
  2292. |
  2293. | EXAMPLE:  
  2294. |
  2295. | NOTE: 
  2296. |
  2297. | ASSUMES: 
  2298. |
  2299. | HISTORY: 11.16.93 by Lee Malone
  2300. |
  2301. ------------------------------------------------------------*/
  2302. Truth
  2303. Test_PullTheListAndItem()
  2304. {
  2305.     Quad    i;
  2306.     
  2307.     TheList = TestList;
  2308.     TheItem = TestItem;
  2309.     
  2310.     i = TheListStackIndex;
  2311.     
  2312.     PushTheListAndItem();
  2313.     
  2314.     TheList = (AddressOfList) 0;
  2315.     TheItem = (AddressOfItem) 0;
  2316.     
  2317.     PullTheListAndItem();
  2318.     
  2319.         if(TheListStackIndex != i)  return(1);
  2320.         if(TheList != TestList)     return(2);
  2321.         if(TheItem != TestItem)     return(3);
  2322.         
  2323.     return(False);
  2324. }
  2325.  
  2326. /*------------------------------------------------------------
  2327. | NAME: Test_MarkListAsEmpty
  2328. |
  2329. | PURPOSE: To test the 'MarkListAsEmpty' procedure.
  2330. |
  2331. | DESCRIPTION: Returns non-zero if error detected.
  2332. |
  2333. | EXAMPLE:  
  2334. |
  2335. | NOTE: 
  2336. |
  2337. | ASSUMES: 
  2338. |
  2339. | HISTORY: 11.16.93 by Lee Malone
  2340. |
  2341. ------------------------------------------------------------*/
  2342. Truth
  2343. Test_MarkListAsEmpty()
  2344. {
  2345.     
  2346.     TheList = TestList;
  2347.     
  2348.     TheFirstItem = TestItem;
  2349.     TheLastItem  = TestItem;
  2350.     TheItemCount = (Quad) 1;
  2351.     
  2352.     MarkListAsEmpty(TestList);
  2353.     
  2354.         if(TheItemCount != (Quad) 0)             return(1);
  2355.         if(TheFirstItem != (AddressOfItem) 0)    return(2);
  2356.         if(TheLastItem  != (AddressOfItem) 0)    return(3);
  2357.         
  2358.     return(False);
  2359. }
  2360.  
  2361. /*------------------------------------------------------------
  2362. | NAME: Test_IsAnyItemsInList
  2363. |
  2364. | PURPOSE: To test the 'IsAnyItemsInList' procedure.
  2365. |
  2366. | DESCRIPTION: Returns non-zero if error detected.
  2367. |
  2368. | EXAMPLE:  
  2369. |
  2370. | NOTE: 
  2371. |
  2372. | ASSUMES: 
  2373. |
  2374. | HISTORY: 11.16.93 by Lee Malone
  2375. |
  2376. ------------------------------------------------------------*/
  2377. Truth
  2378. Test_IsAnyItemsInList()
  2379. {
  2380.     
  2381.     TheList = TestList;
  2382.     
  2383.     TheFirstItem = TestItem;
  2384.     TheLastItem  = TestItem;
  2385.     TheItemCount = (Quad) 1;
  2386.         if(!IsAnyItemsInList(TheList)) return(1);
  2387.  
  2388.     MarkListAsEmpty(TestList);
  2389.         if(IsAnyItemsInList(TheList)) return(2);
  2390.     
  2391.     return(False);
  2392. }
  2393.  
  2394. /*------------------------------------------------------------
  2395. | NAME: Test_IsItemCreationPossible
  2396. |
  2397. | PURPOSE: To test the 'IsItemCreationPossible' procedure.
  2398. |
  2399. | DESCRIPTION: Returns non-zero if error detected.
  2400. |
  2401. | EXAMPLE:  
  2402. |
  2403. | NOTE: 
  2404. |
  2405. | ASSUMES: 
  2406. |
  2407. | HISTORY: 11.16.93 by Lee Malone
  2408. |
  2409. ------------------------------------------------------------*/
  2410. Truth
  2411. Test_IsItemCreationPossible()
  2412. {
  2413.     Quad    Temp;
  2414.     
  2415.     Temp = CountOfFreeItems;
  2416.     
  2417.     CountOfFreeItems = (Quad) 1;
  2418.         if(!IsItemCreationPossible()) return(1);
  2419.  
  2420.     CountOfFreeItems = (Quad) 0;
  2421.         if(IsItemCreationPossible()) return(2);
  2422.  
  2423.     CountOfFreeItems = Temp;
  2424.     
  2425.     return(False);
  2426. }
  2427.  
  2428. /*------------------------------------------------------------
  2429. | NAME: Test_IsListCreationPossible
  2430. |
  2431. | PURPOSE: To test the 'IsListCreationPossible' procedure.
  2432. |
  2433. | DESCRIPTION: Returns non-zero if error detected.
  2434. |
  2435. | EXAMPLE:  
  2436. |
  2437. | NOTE: 
  2438. |
  2439. | ASSUMES: 
  2440. |
  2441. | HISTORY: 11.16.93 by Lee Malone
  2442. |
  2443. ------------------------------------------------------------*/
  2444. Truth
  2445. Test_IsListCreationPossible()
  2446. {
  2447.     Quad    Temp;
  2448.     
  2449.     Temp = CountOfFreeLists;
  2450.     
  2451.     CountOfFreeLists = (Quad) 1;
  2452.         if(!IsListCreationPossible()) return(1);
  2453.  
  2454.     CountOfFreeLists = (Quad) 0;
  2455.         if(IsListCreationPossible()) return(2);
  2456.  
  2457.     CountOfFreeLists = Temp;
  2458.     
  2459.     return(False);
  2460. }
  2461.  
  2462. /*------------------------------------------------------------
  2463. | NAME: Test_CreateItem
  2464. |
  2465. | PURPOSE: To test the 'CreateItem' procedure.
  2466. |
  2467. | DESCRIPTION: Returns non-zero if error detected.
  2468. |
  2469. | EXAMPLE:  
  2470. |
  2471. | NOTE: 
  2472. |
  2473. | ASSUMES: 
  2474. |
  2475. | HISTORY: 11.17.93 by Lee Malone
  2476. |
  2477. ------------------------------------------------------------*/
  2478. Truth
  2479. Test_CreateItem()
  2480. {
  2481.     AddressOfItem    AnItem;
  2482.     Quad            CountBefore;
  2483.     AddressOfItem    SecondFreeItem;
  2484.     
  2485.     CountBefore     = CountOfFreeItems;
  2486.     SecondFreeItem  = GetNextItem(FirstFreeItem);
  2487.     
  2488.     AnItem = CreateItem();
  2489.     
  2490.         if(CountOfFreeItems < 0)                return(1);
  2491.         if(CountOfFreeItems != CountBefore - 1) return(2);
  2492.         if(FirstFreeItem    != SecondFreeItem)  return(3);
  2493.         if(IsItemMarked(AnItem))                return(4);
  2494.         
  2495.     /* 
  2496.        The following procedure is not validated at this 
  2497.        point in the test sequence so it can't be used
  2498.        to establish the validity of the procedure being
  2499.        tested.  It's only to clean up after the test.
  2500.     */
  2501.     DeleteItem(AnItem); 
  2502.     
  2503.     return(False);
  2504. }
  2505.  
  2506. /*------------------------------------------------------------
  2507. | NAME: Test_DeleteItem
  2508. |
  2509. | PURPOSE: To test the 'DeleteItem' procedure.
  2510. |
  2511. | DESCRIPTION: Returns non-zero if error detected.
  2512. |
  2513. | EXAMPLE:  
  2514. |
  2515. | NOTE: 
  2516. |
  2517. | ASSUMES: 
  2518. |
  2519. | HISTORY: 11.17.93 by Lee Malone
  2520. |
  2521. ------------------------------------------------------------*/
  2522. Truth
  2523. Test_DeleteItem()
  2524. {
  2525.     AddressOfItem    AnItem;
  2526.     Quad             CountBefore;
  2527.     AddressOfItem    FreeItemBefore;
  2528.     
  2529.     AnItem = CreateItem();
  2530.  
  2531.     CountBefore     = CountOfFreeItems;
  2532.     FreeItemBefore  = FirstFreeItem;
  2533.     
  2534.     DeleteItem(AnItem); 
  2535.  
  2536.         if(CountOfFreeItems <= 0)               return(1);
  2537.         if(CountOfFreeItems != CountBefore + 1) return(2);
  2538.         if(GetNextItem(FirstFreeItem) != FreeItemBefore) 
  2539.                                                 return(3);
  2540.     return(False);
  2541. }
  2542.  
  2543. /*------------------------------------------------------------
  2544. | NAME: Test_CreateItemForData
  2545. |
  2546. | PURPOSE: To test the 'CreateItemForData' procedure.
  2547. |
  2548. | DESCRIPTION: Returns non-zero if error detected.
  2549. |
  2550. | EXAMPLE:  
  2551. |
  2552. | NOTE: 
  2553. |
  2554. | ASSUMES: 
  2555. |
  2556. | HISTORY: 11.17.93 by Lee Malone
  2557. |
  2558. ------------------------------------------------------------*/
  2559. Truth
  2560. Test_CreateItemForData()
  2561. {
  2562.     Byte            SomeData[] = "A is A.";
  2563.     AddressOfItem   AnItem;
  2564.  
  2565.     AnItem = CreateItemForData(SomeData);
  2566.     
  2567.         if(GetItemDataAddress(AnItem) != SomeData) return(1);
  2568.  
  2569.     DeleteItem(AnItem); 
  2570.     
  2571.     return(False);
  2572. }
  2573.  
  2574. /*------------------------------------------------------------
  2575. | NAME: Test_CreateList
  2576. |
  2577. | PURPOSE: To test the 'CreateList' procedure.
  2578. |
  2579. | DESCRIPTION: Returns non-zero if error detected.
  2580. |
  2581. | EXAMPLE:  
  2582. |
  2583. | NOTE: 
  2584. |
  2585. | ASSUMES: 
  2586. |
  2587. | HISTORY: 11.17.93 by Lee Malone
  2588. |
  2589. ------------------------------------------------------------*/
  2590. Truth
  2591. Test_CreateList()
  2592. {
  2593.     AddressOfList    AList;
  2594.     Quad             CountBefore;
  2595.     AddressOfList    SecondFreeList;
  2596.     
  2597.     CountBefore     = CountOfFreeLists;
  2598.     SecondFreeList  = (AddressOfList) 
  2599.                       GetFirstItemOfList(FirstFreeList);
  2600.     
  2601.     AList = CreateList();
  2602.     
  2603.         if(CountOfFreeLists < 0)                return(1);
  2604.         if(CountOfFreeLists != CountBefore - 1) return(2);
  2605.         if(FirstFreeList    != SecondFreeList)  return(3);
  2606.         if(IsListMarked(AList))                 return(4);
  2607.         if(IsAnyItemsInList(AList))             return(5);
  2608.         
  2609.     /* 
  2610.        The following procedure is not validated at this 
  2611.        point in the test sequence so it can't be used
  2612.        to establish the validity of the procedure being
  2613.        tested.  It's only to clean up after the test.
  2614.     */
  2615.     DeleteList(AList); 
  2616.     
  2617.     return(False);
  2618. }
  2619.  
  2620. /*------------------------------------------------------------
  2621. | NAME: Test_AddToListItemCount
  2622. |
  2623. | PURPOSE: To test the 'AddToListItemCount' macro.
  2624. |
  2625. | DESCRIPTION: Returns non-zero if error detected.
  2626. |
  2627. | EXAMPLE:  
  2628. |
  2629. | NOTE: 
  2630. |
  2631. | ASSUMES: 
  2632. |
  2633. | HISTORY: 11.17.93 by Lee Malone
  2634. |
  2635. ------------------------------------------------------------*/
  2636. Truth
  2637. Test_AddToListItemCount()
  2638. {
  2639.     Quad             CountBefore;
  2640.     AddressOfItem    AnItem;
  2641.     
  2642.     PushTheListAndItem();
  2643.     
  2644.     TheList = TestList;
  2645.     
  2646.     TheItemCount = 0;
  2647.     
  2648.     AddToListItemCount( TheList, 1);
  2649.         if(TheItemCount != (Quad) 1) return(1);
  2650.  
  2651.     PullTheListAndItem();
  2652.         
  2653.     return(False);
  2654. }
  2655.  
  2656. /*------------------------------------------------------------
  2657. | NAME: Test_InsertItemLastInList
  2658. |
  2659. | PURPOSE: To test the 'InsertItemLastInList' procedure.
  2660. |
  2661. | DESCRIPTION: Returns non-zero if error detected.
  2662. |
  2663. | EXAMPLE:  
  2664. |
  2665. | NOTE: 
  2666. |
  2667. | ASSUMES: 
  2668. |
  2669. | HISTORY: 11.17.93 by Lee Malone
  2670. |
  2671. ------------------------------------------------------------*/
  2672. Truth
  2673. Test_InsertItemLastInList()
  2674. {
  2675.     AddressOfItem    FirstItem;
  2676.     AddressOfItem    SecondItem;
  2677.     AddressOfByte    SomeData;
  2678.     
  2679.     PushTheListAndItem();
  2680.     
  2681.     TheList = CreateList();
  2682.  
  2683.     SomeData = (AddressOfByte) "Existence is identity.";
  2684.     FirstItem = CreateItemForData(SomeData);
  2685.     InsertItemLastInList(TheList,FirstItem);
  2686.     
  2687.         if(TheItemCount != 1)             return(1);
  2688.         if(TheFirstItem != FirstItem)     return(2);
  2689.         if(TheLastItem  != FirstItem)     return(3);
  2690.  
  2691.     SomeData = (AddressOfByte) "Consciousness is identification.";
  2692.     SecondItem = CreateItemForData(SomeData);
  2693.     InsertItemLastInList(TheList,SecondItem);
  2694.     
  2695.         if(TheItemCount != 2)                         return(4);
  2696.         if(TheLastItem != SecondItem)                 return(5);
  2697.         if(TheFirstItem != FirstItem)                 return(6);
  2698.         if(GetNextItem(FirstItem) != SecondItem)     return(7);
  2699.         if(GetPriorItem(SecondItem) != FirstItem)     return(8);
  2700.         
  2701.     /* 
  2702.        The following procedure is not validated at this 
  2703.        point in the test sequence so it can't be used
  2704.        to establish the validity of the procedure being
  2705.        tested.  It's only to clean up after the test.
  2706.     */
  2707.     DeleteList(TheList); 
  2708.  
  2709.     PullTheListAndItem();
  2710.  
  2711.     return(False);
  2712. }
  2713.  
  2714. /*------------------------------------------------------------
  2715. | NAME: Test_InsertDataLastInList
  2716. |
  2717. | PURPOSE: To test the 'InsertDataLastInList' procedure.
  2718. |
  2719. | DESCRIPTION: Returns non-zero if error detected.
  2720. |
  2721. | EXAMPLE:  
  2722. |
  2723. | NOTE: 
  2724. |
  2725. | ASSUMES: 
  2726. |
  2727. | HISTORY: 11.17.93 by Lee Malone
  2728. |
  2729. ------------------------------------------------------------*/
  2730. Truth
  2731. Test_InsertDataLastInList()
  2732. {
  2733.     AddressOfItem    FirstItem;
  2734.     AddressOfItem    SecondItem;
  2735.     AddressOfByte    SomeData;
  2736.     
  2737.     PushTheListAndItem();
  2738.     
  2739.     TheList = CreateList();
  2740.  
  2741.     SomeData = (AddressOfByte) "Existence is identity.";
  2742.     FirstItem = InsertDataLastInList(TheList,SomeData);
  2743.     
  2744.     TheItem = FirstItem;
  2745.         if(TheDataAddress != SomeData)     return(1);
  2746.  
  2747.     SomeData = (AddressOfByte) 
  2748.                "Consciousness is identification.";
  2749.     SecondItem = InsertDataLastInList(TheList,SomeData);
  2750.     
  2751.     TheItem = SecondItem;
  2752.         if(TheDataAddress != SomeData)     return(2);
  2753.         
  2754.     /* 
  2755.        The following procedure is not validated at this 
  2756.        point in the test sequence so it can't be used
  2757.        to establish the validity of the procedure being
  2758.        tested.  It's only to clean up after the test.
  2759.     */
  2760.     DeleteList(TheList); 
  2761.  
  2762.     PullTheListAndItem();
  2763.  
  2764.     return(False);
  2765. }
  2766.  
  2767. /*------------------------------------------------------------
  2768. | NAME: Test_ExtractTheItem
  2769. |
  2770. | PURPOSE: To test the 'ExtractTheItem' procedure.
  2771. |
  2772. | DESCRIPTION: Returns non-zero if error detected.
  2773. |
  2774. | EXAMPLE:  
  2775. |
  2776. | NOTE: 
  2777. |
  2778. | ASSUMES: 
  2779. |
  2780. | HISTORY: 11.17.93 by Lee Malone
  2781. |
  2782. ------------------------------------------------------------*/
  2783. Truth
  2784. Test_ExtractTheItem()
  2785. {
  2786.     AddressOfItem    FirstItem;
  2787.     AddressOfItem    SecondItem;
  2788.     AddressOfItem    ThirdItem;
  2789.     AddressOfItem    ExtractedItem;
  2790.     AddressOfByte    SomeData;
  2791.     
  2792.     PushTheListAndItem();
  2793.     
  2794.     TheList = CreateList();
  2795.  
  2796.     SomeData = (AddressOfByte) "aaa";
  2797.     FirstItem = InsertDataLastInList(TheList,SomeData);
  2798.     
  2799.     SomeData = (AddressOfByte) "bbb";
  2800.     SecondItem = InsertDataLastInList(TheList,SomeData);
  2801.  
  2802.     SomeData = (AddressOfByte) "ccc";
  2803.     ThirdItem = InsertDataLastInList(TheList,SomeData);
  2804.     
  2805.     /* CASE: extracting last item */
  2806.     TheItem = ThirdItem;
  2807.     ExtractedItem = ExtractTheItem();
  2808.         if(ExtractedItem != ThirdItem)                  return(1);
  2809.         if(TheItemCount != 2)                       return(2);
  2810.         if(TheItem != SecondItem)                   return(3);
  2811.         if(GetNextItem(FirstItem) != SecondItem)  return(4);
  2812.         if(GetPriorItem(SecondItem) != FirstItem) return(5);
  2813.         if(TheFirstItem != FirstItem)             return(6);
  2814.         if(TheLastItem != SecondItem)             return(7);
  2815.         
  2816.     InsertItemLastInList(TheList,ExtractedItem); /* put back the item */
  2817.     
  2818.     /* CASE: extracting middle item */
  2819.     TheItem = SecondItem;
  2820.     ExtractedItem = ExtractTheItem();
  2821.     
  2822.         if(ExtractedItem != SecondItem)          return(8);
  2823.         if(TheItemCount != 2)                      return(9);
  2824.         if(TheItem != FirstItem)                  return(10);
  2825.         if(GetNextItem(FirstItem) != ThirdItem)  return(11);
  2826.         if(GetPriorItem(ThirdItem) != FirstItem) return(12);
  2827.         if(TheFirstItem != FirstItem)            return(13);
  2828.         if(TheLastItem != ThirdItem)             return(14);
  2829.  
  2830.     DeleteItem(ExtractedItem);
  2831.     
  2832.     /* CASE: extracting first item */
  2833.     TheItem = FirstItem;
  2834.     ExtractedItem = ExtractTheItem();
  2835.     
  2836.         if(ExtractedItem != FirstItem)              return(15);
  2837.         if(TheItemCount != 1)                      return(16);
  2838.         if(TheItem != ThirdItem)                  return(17);
  2839.         if(!IsItemAlone(ThirdItem))              return(18);
  2840.         if(TheFirstItem != ThirdItem)            return(19);
  2841.         if(TheLastItem != ThirdItem)             return(20);
  2842.  
  2843.     DeleteItem(ExtractedItem);
  2844.  
  2845.     /* CASE: extracting lone item */
  2846.     ExtractedItem = ExtractTheItem();
  2847.     
  2848.         if(ExtractedItem != ThirdItem)              return(21);
  2849.         if(TheItemCount != 0)                      return(22);
  2850.         if(TheItem != (AddressOfItem) 0)          return(23);
  2851.         if(TheFirstItem != (AddressOfItem) 0)    return(24);
  2852.         if(TheLastItem != (AddressOfItem) 0)     return(25);
  2853.     DeleteItem(ExtractedItem);
  2854.  
  2855.     /* 
  2856.        The following procedure is not validated at this 
  2857.        point in the test sequence so it can't be used
  2858.        to establish the validity of the procedure being
  2859.        tested.  It's only to clean up after the test.
  2860.     */
  2861.     DeleteList(TheList); 
  2862.  
  2863.     PullTheListAndItem();
  2864.  
  2865.     return(False);
  2866. }
  2867.  
  2868. /*------------------------------------------------------------
  2869. | NAME: Test_ExtractItemFromList
  2870. |
  2871. | PURPOSE: To test the 'ExtractItemFromList' procedure.
  2872. |
  2873. | DESCRIPTION: Returns non-zero if error detected.
  2874. |
  2875. | EXAMPLE:  
  2876. |
  2877. | NOTE: 
  2878. |
  2879. | ASSUMES: 
  2880. |
  2881. | HISTORY: 11.18.93 by Lee Malone
  2882. |
  2883. ------------------------------------------------------------*/
  2884. Truth
  2885. Test_ExtractItemFromList()
  2886. {
  2887.     AddressOfItem    FirstItem;
  2888.     AddressOfItem    SecondItem;
  2889.     AddressOfItem    ThirdItem;
  2890.     AddressOfItem    ExtractedItem;
  2891.     AddressOfByte    SomeData;
  2892.     
  2893.     PushTheListAndItem();
  2894.     
  2895.     TheList = CreateList();
  2896.  
  2897.     SomeData = (AddressOfByte) "aaa";
  2898.     FirstItem = InsertDataLastInList(TheList,SomeData);
  2899.     
  2900.     SomeData = (AddressOfByte) "bbb";
  2901.     SecondItem = InsertDataLastInList(TheList,SomeData);
  2902.  
  2903.     SomeData = (AddressOfByte) "ccc";
  2904.     ThirdItem = InsertDataLastInList(TheList,SomeData);
  2905.     
  2906.     /* CASE: extracting last item */
  2907.     ToFirstItem();
  2908.     ExtractedItem = ExtractItemFromList(TheList,ThirdItem);
  2909.         if(ExtractedItem != ThirdItem)                  return(1);
  2910.         if(TheItemCount != 2)                       return(2);
  2911.         if(TheItem != FirstItem)                   return(3);
  2912.         if(GetNextItem(FirstItem) != SecondItem)  return(4);
  2913.         if(GetPriorItem(SecondItem) != FirstItem) return(5);
  2914.         if(TheFirstItem != FirstItem)             return(6);
  2915.         if(TheLastItem != SecondItem)             return(7);
  2916.         
  2917.     InsertItemLastInList(TheList,ExtractedItem); /* put back the item */
  2918.     
  2919.     /* CASE: extracting middle item */
  2920.     ToLastItem();
  2921.     ExtractedItem = ExtractItemFromList(TheList,SecondItem);
  2922.     
  2923.         if(ExtractedItem != SecondItem)          return(8);
  2924.         if(TheItemCount != 2)                      return(9);
  2925.         if(TheItem != ThirdItem)                  return(10);
  2926.         if(GetNextItem(FirstItem) != ThirdItem)  return(11);
  2927.         if(GetPriorItem(ThirdItem) != FirstItem) return(12);
  2928.         if(TheFirstItem != FirstItem)            return(13);
  2929.         if(TheLastItem != ThirdItem)             return(14);
  2930.     DeleteItem(ExtractedItem);
  2931.  
  2932.     /* CASE: extracting first item */
  2933.     
  2934.     ExtractedItem = ExtractItemFromList(TheList,FirstItem);
  2935.     
  2936.         if(ExtractedItem != FirstItem)              return(15);
  2937.         if(TheItemCount != 1)                      return(16);
  2938.         if(TheItem != ThirdItem)                  return(17);
  2939.         if(!IsItemAlone(ThirdItem))              return(18);
  2940.         if(TheFirstItem != ThirdItem)            return(19);
  2941.         if(TheLastItem != ThirdItem)             return(20);
  2942.     DeleteItem(ExtractedItem);
  2943.  
  2944.     /* CASE: extracting lone item */
  2945.     ExtractedItem = ExtractItemFromList(TheList,ThirdItem);
  2946.     
  2947.         if(ExtractedItem != ThirdItem)              return(21);
  2948.         if(TheItemCount != 0)                      return(22);
  2949.         if(TheItem != ThirdItem)                   return(23);
  2950.         if(TheFirstItem != (AddressOfItem) 0)    return(24);
  2951.         if(TheLastItem != (AddressOfItem) 0)     return(25);
  2952.     DeleteItem(ExtractedItem);
  2953.     /* 
  2954.        The following procedure is not validated at this 
  2955.        point in the test sequence so it can't be used
  2956.        to establish the validity of the procedure being
  2957.        tested.  It's only to clean up after the test.
  2958.     */
  2959.     DeleteList(TheList); 
  2960.  
  2961.     PullTheListAndItem();
  2962.  
  2963.     return(False);
  2964. }
  2965.  
  2966. /*------------------------------------------------------------
  2967. | NAME: Test_DeleteList
  2968. |
  2969. | PURPOSE: To test the 'DeleteList' procedure.
  2970. |
  2971. | DESCRIPTION: Returns non-zero if error detected.
  2972. |
  2973. | EXAMPLE:  
  2974. |
  2975. | NOTE: 
  2976. |
  2977. | ASSUMES: 
  2978. |
  2979. | HISTORY: 11.17.93 by Lee Malone
  2980. |
  2981. ------------------------------------------------------------*/
  2982. Truth
  2983. Test_DeleteList()
  2984. {
  2985.     Quad            ItemCountBefore;
  2986.     Quad            ListCountBefore;
  2987.     AddressOfList   FreeListBefore;
  2988.     
  2989.     PushTheListAndItem();
  2990.     
  2991.     TheList = CreateList();
  2992.     
  2993.     InsertDataLastInList(TheList,(AddressOfByte) "aaa");
  2994.     InsertDataLastInList(TheList,(AddressOfByte) "bbb");
  2995.     InsertDataLastInList(TheList,(AddressOfByte) "ccc");
  2996.     
  2997.     ItemCountBefore = CountOfFreeItems;
  2998.     ListCountBefore = CountOfFreeLists;
  2999.     FreeListBefore  = FirstFreeList;
  3000.     
  3001.     DeleteList(TheList);
  3002.     
  3003.         if(CountOfFreeItems != ItemCountBefore + (Quad) 3) return(1);
  3004.         if(CountOfFreeLists != ListCountBefore + (Quad) 1) return(2);
  3005.         if(FirstFreeList != TheList)                       return(3);
  3006.         if((AddressOfList) 
  3007.            GetFirstItemOfList(FirstFreeList) != 
  3008.            FreeListBefore)                           return(4);
  3009.            
  3010.     PullTheListAndItem();
  3011.     
  3012.     return(False);
  3013. }
  3014.  
  3015. /*------------------------------------------------------------
  3016. | NAME: MakeSampleListOfStaticStrings
  3017. |
  3018. | PURPOSE: To make a list of strings allocated at compile time
  3019. | to be used for testing other procedures. 
  3020. |
  3021. | DESCRIPTION: Returns the list record address of a list
  3022. | which looks like this:
  3023. |
  3024. |        [LIST]--->[ITEM]--->"AAAA"
  3025. |                  [ITEM]--->"BBBB"
  3026. |                  [ITEM]--->"CCCC"
  3027. |
  3028. | EXAMPLE:  AList = MakeSampleListOfStaticStrings();
  3029. |
  3030. | NOTE: 
  3031. |
  3032. | ASSUMES: 
  3033. |
  3034. | HISTORY: 11.18.93 by Lee Malone
  3035. |
  3036. ------------------------------------------------------------*/
  3037. Byte            AData[] = "AAAA";
  3038. Byte            BData[] = "BBBB";
  3039. Byte            CData[] = "CCCC";
  3040. AddressOfList
  3041. MakeSampleListOfStaticStrings()
  3042. {
  3043.     AddressOfList    AList;
  3044.     AddressOfByte    SomeData;
  3045.     
  3046.     AList = CreateList();
  3047.     
  3048.     InsertDataLastInList(AList,AData);
  3049.     InsertDataLastInList(AList,BData);
  3050.     InsertDataLastInList(AList,CData);
  3051.     
  3052.     return(AList);
  3053. }
  3054.  
  3055. /*------------------------------------------------------------
  3056. | NAME: MakeSampleListOfDynamicStrings
  3057. |
  3058. | PURPOSE: To make a list of dynamically allocated strings
  3059. | to be used for testing other procedures. 
  3060. |
  3061. | DESCRIPTION: Returns the list record address of a list
  3062. | which looks like this:
  3063. |
  3064. |        [LIST]--->[ITEM]--->"AAAA"
  3065. |                  [ITEM]--->"BBBB"
  3066. |                  [ITEM]--->"CCCC"
  3067. |
  3068. | EXAMPLE:  AList = MakeSampleListOfDynamicStrings();
  3069. |
  3070. | NOTE: 
  3071. |
  3072. | ASSUMES: 'AllocateMemory' is valid.
  3073. |
  3074. | HISTORY: 11.18.93 by Lee Malone
  3075. |
  3076. ------------------------------------------------------------*/
  3077. AddressOfList
  3078. MakeSampleListOfDynamicStrings()
  3079. {
  3080.     AddressOfList    AList;
  3081.     AddressOfByte    SomeData;
  3082.     
  3083.     AList = CreateList();
  3084.     
  3085.     SomeData = AllocateMemory(5);
  3086.     CopyString("AAAA",(AddressOfString) SomeData);
  3087.     InsertDataLastInList(AList,SomeData);
  3088.     
  3089.     SomeData = AllocateMemory(5);
  3090.     CopyString("BBBB",(AddressOfString) SomeData);
  3091.     InsertDataLastInList(AList,SomeData);
  3092.     
  3093.     SomeData = AllocateMemory(5);
  3094.     CopyString("CCCC",(AddressOfString) SomeData);
  3095.     InsertDataLastInList(AList,SomeData);
  3096.     
  3097.     return(AList);
  3098. }
  3099.  
  3100. /*------------------------------------------------------------
  3101. | NAME: Test_DeleteListOfDynamicData
  3102. |
  3103. | PURPOSE: To test the 'DeleteListOfDynamicData' procedure.
  3104. |
  3105. | DESCRIPTION: Returns non-zero if error detected.
  3106. |
  3107. | EXAMPLE:  
  3108. |
  3109. | NOTE: 
  3110. |
  3111. | ASSUMES: 'AllocateMemory' and 'FreeMemory' are valid.
  3112. |
  3113. | HISTORY: 11.18.93 by Lee Malone
  3114. |
  3115. ------------------------------------------------------------*/
  3116. Truth
  3117. Test_DeleteListOfDynamicData()
  3118. {
  3119.     Quad            ItemCountBefore;
  3120.     Quad            ListCountBefore;
  3121.     AddressOfList   AList;
  3122.     
  3123.     AList = MakeSampleListOfDynamicStrings();
  3124.     
  3125.     ItemCountBefore = CountOfFreeItems;
  3126.     ListCountBefore = CountOfFreeLists;
  3127.     
  3128.     DeleteListOfDynamicData(AList);
  3129.         if(ItemCountBefore != CountOfFreeItems - (Quad) 3) 
  3130.             return(1);
  3131.         if(ListCountBefore != CountOfFreeLists - (Quad) 1) 
  3132.             return(2);
  3133.         
  3134.     return(False);
  3135. }
  3136.  
  3137. /*------------------------------------------------------------
  3138. | NAME: Test_FindFirstItemLinkedToData
  3139. |
  3140. | PURPOSE: To test the 'FindFirstItemLinkedToData' procedure.
  3141. |
  3142. | DESCRIPTION: Returns non-zero if error detected.
  3143. |
  3144. | EXAMPLE:  
  3145. |
  3146. | NOTE: 
  3147. |
  3148. | ASSUMES: 
  3149. |
  3150. | HISTORY: 11.18.93 by Lee Malone
  3151. |
  3152. ------------------------------------------------------------*/
  3153. Truth
  3154. Test_FindFirstItemLinkedToData()
  3155. {
  3156.     AddressOfByte    FirstData;
  3157.     AddressOfByte    MiddleData;
  3158.     AddressOfByte    LastData;
  3159.     AddressOfItem    AnItem;
  3160.     
  3161.     PushTheListAndItem();
  3162.     
  3163.     TheList = MakeSampleListOfDynamicStrings();
  3164.     
  3165.     FirstData  = GetItemDataAddress(TheFirstItem);
  3166.     MiddleData = GetItemDataAddress(GetNextItem(TheFirstItem));
  3167.     LastData   = GetItemDataAddress(TheLastItem);
  3168.     
  3169.     AnItem = FindFirstItemLinkedToData(TheList,FirstData);
  3170.         if(AnItem != TheFirstItem) return(1);
  3171.         
  3172.     AnItem = FindFirstItemLinkedToData(TheList,MiddleData);
  3173.         if(AnItem != GetNextItem(TheFirstItem)) return(2);
  3174.  
  3175.     AnItem = FindFirstItemLinkedToData(TheList,LastData);
  3176.         if(AnItem != TheLastItem) return(3);
  3177.  
  3178.     DeleteListOfDynamicData(TheList);
  3179.         
  3180.     return(False);
  3181. }
  3182.  
  3183. /*------------------------------------------------------------
  3184. | NAME: Test_DeleteFirstReferenceToData
  3185. |
  3186. | PURPOSE: To test the 'DeleteFirstReferenceToData' procedure.
  3187. |
  3188. | DESCRIPTION: Returns non-zero if error detected.
  3189. |
  3190. | EXAMPLE:  
  3191. |
  3192. | NOTE: 
  3193. |
  3194. | ASSUMES: 
  3195. |
  3196. | HISTORY: 11.18.93 by Lee Malone
  3197. |
  3198. ------------------------------------------------------------*/
  3199. Truth
  3200. Test_DeleteFirstReferenceToData()
  3201. {
  3202.     AddressOfItem    AnItem;
  3203.     AddressOfItem    FirstItem;
  3204.     AddressOfItem    MiddleItem;
  3205.     AddressOfItem    LastItem;
  3206.     
  3207.     PushTheListAndItem();
  3208.     
  3209.     TheList = MakeSampleListOfStaticStrings();
  3210.     
  3211.     FirstItem  = TheFirstItem;
  3212.     MiddleItem = GetNextItem(TheFirstItem);
  3213.     LastItem   = TheLastItem;
  3214.     
  3215.     AnItem = DeleteFirstReferenceToData(TheList,(AddressOfByte) 1);
  3216.         if(AnItem) return(1);
  3217.         if(TheItemCount != (Quad) 3) return(2);
  3218.  
  3219.     AnItem = DeleteFirstReferenceToData(TheList,BData);
  3220.         if(AnItem != MiddleItem) return(3);
  3221.  
  3222.     AnItem = DeleteFirstReferenceToData(TheList,AData);
  3223.         if(AnItem != FirstItem) return(4);
  3224.         
  3225.     AnItem = DeleteFirstReferenceToData(TheList,CData);
  3226.         if(AnItem != LastItem) return(5);
  3227.  
  3228.     DeleteList(TheList);
  3229.     
  3230.     PullTheListAndItem();
  3231.     
  3232.     return(False);
  3233. }
  3234.  
  3235. /*------------------------------------------------------------
  3236. | NAME: Test_DeleteAllReferencesToData
  3237. |
  3238. | PURPOSE: To test the 'DeleteAllReferencesToData' procedure.
  3239. |
  3240. | DESCRIPTION: Returns non-zero if error detected.
  3241. |
  3242. | EXAMPLE:  
  3243. |
  3244. | NOTE: 
  3245. |
  3246. | ASSUMES: 
  3247. |
  3248. | HISTORY: 11.18.93 by Lee Malone
  3249. |
  3250. ------------------------------------------------------------*/
  3251. Truth
  3252. Test_DeleteAllReferencesToData()
  3253. {
  3254.     AddressOfItem    AnItem;
  3255.     AddressOfItem    FirstItem;
  3256.     AddressOfItem    MiddleItem;
  3257.     AddressOfItem    LastItem;
  3258.     
  3259.     PushTheListAndItem();
  3260.     
  3261.     TheList = MakeSampleListOfStaticStrings();
  3262.     
  3263.     FirstItem  = TheFirstItem;
  3264.     MiddleItem = GetNextItem(TheFirstItem);
  3265.     LastItem   = TheLastItem;
  3266.     
  3267.     PutItemDataAddress( TheLastItem, BData );
  3268.     
  3269.     DeleteAllReferencesToData( TheList, (AddressOfByte) 1 );
  3270.         if(TheItemCount != (Quad) 3) return(1);
  3271.     
  3272.     DeleteAllReferencesToData( TheList, BData );
  3273.         if(TheItemCount != (Quad) 1)  return(2);
  3274.         if(TheFirstItem != FirstItem) return(3);
  3275.         if(TheLastItem != FirstItem)  return(4);
  3276.  
  3277.     DeleteAllReferencesToData( TheList, AData );
  3278.         if(TheItemCount != (Quad) 0)          return(5);
  3279.         if(TheFirstItem != (AddressOfItem) 0) return(6);
  3280.         if(TheLastItem != (AddressOfItem) 0)  return(7);
  3281.  
  3282.     DeleteList(TheList);
  3283.     
  3284.     PullTheListAndItem();
  3285.     
  3286.     return(False);
  3287. }
  3288.  
  3289. /*------------------------------------------------------------
  3290. | NAME: Test_IsTheDataMatching
  3291. |
  3292. | PURPOSE: To test the 'IsTheDataMatching' procedure.
  3293. |
  3294. | DESCRIPTION: Returns non-zero if error detected.
  3295. |
  3296. | EXAMPLE:  
  3297. |
  3298. | NOTE: 
  3299. |
  3300. | ASSUMES: 
  3301. |
  3302. | HISTORY: 11.18.93 by Lee Malone
  3303. |
  3304. ------------------------------------------------------------*/
  3305. Truth
  3306. Test_IsTheDataMatching()
  3307. {
  3308.     Truth            Result;
  3309.     
  3310.     PushTheListAndItem();
  3311.     
  3312.     TheList = MakeSampleListOfStaticStrings();
  3313.  
  3314.     ToFirstItem();
  3315.     Result = IsTheDataMatching( (Pair) 0, (Pair) 4, AData );
  3316.         if(Result == 0) return(1);
  3317.  
  3318.         
  3319.     ToNextItem();
  3320.     Result = IsTheDataMatching( (Pair) 0, (Pair) 4, BData );
  3321.         if(Result == 0) return(2);
  3322.  
  3323.         
  3324.     ToNextItem();
  3325.     Result = IsTheDataMatching( (Pair) 0, (Pair) 4, CData );
  3326.         if(Result == 0) return(3);
  3327.  
  3328.     Result = IsTheDataMatching( (Pair) 0, (Pair) 4, BData );
  3329.         if(Result != 0) return(4);
  3330.  
  3331.  
  3332.     DeleteList(TheList);
  3333.     
  3334.     PullTheListAndItem();
  3335.     
  3336.     return(False);
  3337. }
  3338.  
  3339. /*------------------------------------------------------------
  3340. | NAME: Test_FindFirstMatchingItem
  3341. |
  3342. | PURPOSE: To test the 'FindFirstMatchingItem' procedure.
  3343. |
  3344. | DESCRIPTION: Returns non-zero if error detected.
  3345. |
  3346. | EXAMPLE:  
  3347. |
  3348. | NOTE: 
  3349. |
  3350. | ASSUMES: 
  3351. |
  3352. | HISTORY: 11.18.93 by Lee Malone
  3353. |
  3354. ------------------------------------------------------------*/
  3355. Truth
  3356. Test_FindFirstMatchingItem()
  3357. {
  3358.     Truth            Result;
  3359.     AddressOfItem    AnItem;
  3360.     Pair             SearchKeyFieldOffset;
  3361.     Pair             SearchKeyFieldWidth;
  3362.     AddressOfByte    SearchValue;
  3363.     
  3364.     
  3365.     PushTheListAndItem();
  3366.     
  3367.     TheList = MakeSampleListOfStaticStrings();
  3368.  
  3369.     SearchValue          = (AddressOfByte) "XXXX";
  3370.     SearchKeyFieldOffset = 0;
  3371.     SearchKeyFieldWidth     = 4;
  3372.     
  3373.     AnItem = FindFirstMatchingItem( TheList, 
  3374.                                     SearchKeyFieldOffset, 
  3375.                                     SearchKeyFieldWidth, 
  3376.                                     SearchValue );
  3377.     
  3378.         if(AnItem != (AddressOfItem) 0) return(1);
  3379.         
  3380.     SearchValue          = (AddressOfByte) "AAAA";
  3381.     AnItem = FindFirstMatchingItem( TheList, 
  3382.                                     SearchKeyFieldOffset, 
  3383.                                     SearchKeyFieldWidth, 
  3384.                                     SearchValue );
  3385.     
  3386.         if(AnItem != TheFirstItem) return(2);
  3387.         
  3388.     SearchValue          = (AddressOfByte) "BBBB";
  3389.     AnItem = FindFirstMatchingItem( TheList, 
  3390.                                     SearchKeyFieldOffset, 
  3391.                                     SearchKeyFieldWidth, 
  3392.                                     SearchValue );
  3393.     
  3394.         if(AnItem != GetNextItem(TheFirstItem)) return(3);
  3395.         
  3396.     SearchValue          = (AddressOfByte) "CCCC";
  3397.     AnItem = FindFirstMatchingItem( TheList, 
  3398.                                     SearchKeyFieldOffset, 
  3399.                                     SearchKeyFieldWidth, 
  3400.                                     SearchValue );
  3401.     
  3402.         if(AnItem != TheLastItem) return(3);
  3403.  
  3404.     DeleteList(TheList);
  3405.     
  3406.     PullTheListAndItem();
  3407.     
  3408.     return(False);
  3409. }
  3410.  
  3411. /*------------------------------------------------------------
  3412. | NAME: Test_FindNextMatchingItem
  3413. |
  3414. | PURPOSE: To test the 'FindNextMatchingItem' procedure.
  3415. |
  3416. | DESCRIPTION: Returns non-zero if error detected.
  3417. |
  3418. | EXAMPLE:  
  3419. |
  3420. | NOTE: 
  3421. |
  3422. | ASSUMES: 
  3423. |
  3424. | HISTORY: 11.18.93 by Lee Malone
  3425. |
  3426. ------------------------------------------------------------*/
  3427. Truth
  3428. Test_FindNextMatchingItem()
  3429. {
  3430.     Truth            Result;
  3431.     AddressOfItem    AnItem;
  3432.     Pair             SearchKeyFieldOffset;
  3433.     Pair             SearchKeyFieldWidth;
  3434.     AddressOfByte    SearchValue;
  3435.     
  3436.     
  3437.     PushTheListAndItem();
  3438.     
  3439.     TheList = MakeSampleListOfStaticStrings();
  3440.  
  3441.     SearchValue          = (AddressOfByte) "XXXX";
  3442.     SearchKeyFieldOffset = 0;
  3443.     SearchKeyFieldWidth  = 4;
  3444.     
  3445.     AnItem = FindNextMatchingItem( TheList,
  3446.                                    TheFirstItem,
  3447.                                    SearchKeyFieldOffset, 
  3448.                                    SearchKeyFieldWidth, 
  3449.                                    SearchValue );
  3450.     
  3451.         if(AnItem != (AddressOfItem) 0) return(1);
  3452.         
  3453.     SearchValue          = (AddressOfByte) "AAAA";
  3454.     AnItem = FindNextMatchingItem( TheList, 
  3455.                                    TheFirstItem,
  3456.                                    SearchKeyFieldOffset, 
  3457.                                    SearchKeyFieldWidth, 
  3458.                                    SearchValue );
  3459.     
  3460.         if(AnItem == TheFirstItem) return(2);
  3461.         
  3462.     SearchValue          = (AddressOfByte) "BBBB";
  3463.     AnItem = FindNextMatchingItem( TheList, 
  3464.                                    TheFirstItem,
  3465.                                    SearchKeyFieldOffset, 
  3466.                                    SearchKeyFieldWidth, 
  3467.                                    SearchValue );
  3468.     
  3469.         if(AnItem != GetNextItem(TheFirstItem)) return(3);
  3470.         
  3471.     SearchValue          = (AddressOfByte) "CCCC";
  3472.     AnItem = FindNextMatchingItem( TheList, 
  3473.                                    TheFirstItem,
  3474.                                    SearchKeyFieldOffset, 
  3475.                                    SearchKeyFieldWidth, 
  3476.                                    SearchValue );
  3477.     
  3478.         if(AnItem != TheLastItem) return(3);
  3479.  
  3480.     DeleteList(TheList);
  3481.     
  3482.     PullTheListAndItem();
  3483.     
  3484.     return(False);
  3485. }
  3486.  
  3487. /*------------------------------------------------------------
  3488. | NAME: Test_FindFirstMarkedItem
  3489. |
  3490. | PURPOSE: To test the 'FindFirstMarkedItem' procedure.
  3491. |
  3492. | DESCRIPTION: Returns non-zero if error detected.
  3493. |
  3494. | EXAMPLE:  
  3495. |
  3496. | NOTE: 
  3497. |
  3498. | ASSUMES: 
  3499. |
  3500. | HISTORY: 11.19.93 by Lee Malone
  3501. |
  3502. ------------------------------------------------------------*/
  3503. Truth
  3504. Test_FindFirstMarkedItem()
  3505. {
  3506.     Truth            Result;
  3507.     AddressOfItem    AnItem;
  3508.     
  3509.     
  3510.     PushTheListAndItem();
  3511.     
  3512.     TheList = MakeSampleListOfStaticStrings();
  3513.  
  3514.     AnItem = FindFirstMarkedItem( TheList );
  3515.     
  3516.         if(AnItem != (AddressOfItem) 0 ) return(1);
  3517.  
  3518.     MarkItem( TheLastItem );
  3519.     
  3520.     AnItem = FindFirstMarkedItem( TheList );
  3521.     
  3522.         if(AnItem != TheLastItem ) return(2);
  3523.         
  3524.     MarkItem( GetPriorItem(TheLastItem) );
  3525.     
  3526.     AnItem = FindFirstMarkedItem( TheList );
  3527.     
  3528.         if(AnItem != GetPriorItem(TheLastItem) ) return(3);
  3529.  
  3530.     MarkItem( TheFirstItem );
  3531.     
  3532.     AnItem = FindFirstMarkedItem( TheList );
  3533.     
  3534.         if(AnItem != TheFirstItem ) return(4);
  3535.  
  3536.     DeleteList(TheList);
  3537.     
  3538.     PullTheListAndItem();
  3539.     
  3540.     return(False);
  3541. }
  3542.  
  3543. /*------------------------------------------------------------
  3544. | NAME: Test_FindFirstUnMarkedItem
  3545. |
  3546. | PURPOSE: To test the 'FindFirstUnMarkedItem' procedure.
  3547. |
  3548. | DESCRIPTION: Returns non-zero if error detected.
  3549. |
  3550. | EXAMPLE:  
  3551. |
  3552. | NOTE: 
  3553. |
  3554. | ASSUMES: 
  3555. |
  3556. | HISTORY: 11.19.93 by Lee Malone
  3557. |
  3558. ------------------------------------------------------------*/
  3559. Truth
  3560. Test_FindFirstUnMarkedItem()
  3561. {
  3562.     Truth            Result;
  3563.     AddressOfItem    AnItem;
  3564.     
  3565.     
  3566.     PushTheListAndItem();
  3567.     
  3568.     TheList = MakeSampleListOfStaticStrings();
  3569.  
  3570.     AnItem = FindFirstUnMarkedItem( TheList );
  3571.         if(AnItem != TheFirstItem ) return(1);
  3572.  
  3573.     MarkItem( TheFirstItem );
  3574.     AnItem = FindFirstUnMarkedItem( TheList );
  3575.         if(AnItem != GetNextItem(TheFirstItem) ) return(2);
  3576.         
  3577.     MarkItem( GetNextItem(TheFirstItem) );
  3578.     AnItem = FindFirstUnMarkedItem( TheList );
  3579.         if(AnItem != TheLastItem ) return(3);
  3580.  
  3581.     MarkItem( TheLastItem );
  3582.     AnItem = FindFirstUnMarkedItem( TheList );
  3583.     
  3584.         if(AnItem != (AddressOfItem) 0 ) return(4);
  3585.  
  3586.     DeleteList(TheList);
  3587.     
  3588.     PullTheListAndItem();
  3589.     
  3590.     return(False);
  3591. }
  3592.  
  3593. /*------------------------------------------------------------
  3594. | NAME: Test_UnMarkAllItemsInList
  3595. |
  3596. | PURPOSE: To test the 'UnMarkAllItemsInList' procedure.
  3597. |
  3598. | DESCRIPTION: Returns non-zero if error detected.
  3599. |
  3600. | EXAMPLE:  
  3601. |
  3602. | NOTE: 
  3603. |
  3604. | ASSUMES: 
  3605. |
  3606. | HISTORY: 11.19.93 by Lee Malone
  3607. |
  3608. ------------------------------------------------------------*/
  3609. Truth
  3610. Test_UnMarkAllItemsInList()
  3611. {
  3612.     Truth            Result;
  3613.     AddressOfItem    AnItem;
  3614.     
  3615.     
  3616.     PushTheListAndItem();
  3617.     
  3618.     TheList = MakeSampleListOfStaticStrings();
  3619.  
  3620.     MarkItem( TheFirstItem );
  3621.     MarkItem( GetNextItem(TheFirstItem) );
  3622.     MarkItem( TheLastItem );
  3623.     
  3624.     UnMarkAllItemsInList(TheList);
  3625.     
  3626.     AnItem = FindFirstMarkedItem( TheList );
  3627.         if(AnItem != (AddressOfItem) 0 ) return(1);
  3628.         
  3629.     DeleteList(TheList);
  3630.     
  3631.     PullTheListAndItem();
  3632.     
  3633.     return(False);
  3634. }
  3635.  
  3636. /*------------------------------------------------------------
  3637. | NAME: Test_FindIndexOfFirstMarkedItem
  3638. |
  3639. | PURPOSE: To test the 'FindIndexOfFirstMarkedItem' procedure.
  3640. |
  3641. | DESCRIPTION: Returns non-zero if error detected.
  3642. |
  3643. | EXAMPLE:  
  3644. |
  3645. | NOTE: 
  3646. |
  3647. | ASSUMES: 
  3648. |
  3649. | HISTORY: 11.19.93 by Lee Malone
  3650. |
  3651. ------------------------------------------------------------*/
  3652. Truth
  3653. Test_FindIndexOfFirstMarkedItem()
  3654. {
  3655.     Truth    Result;
  3656.     Quad    ItemIndex;    
  3657.     
  3658.     
  3659.     PushTheListAndItem();
  3660.     
  3661.     TheList = MakeSampleListOfStaticStrings();
  3662.  
  3663.     MarkItem( TheLastItem );
  3664.     
  3665.     ItemIndex = FindIndexOfFirstMarkedItem( TheList );
  3666.     
  3667.         if(ItemIndex != (Quad) 2 ) return(1);
  3668.         
  3669.     MarkItem( GetPriorItem(TheLastItem) );
  3670.     
  3671.     ItemIndex = FindIndexOfFirstMarkedItem( TheList );
  3672.     
  3673.         if(ItemIndex != (Quad) 1 ) return(2);
  3674.  
  3675.     MarkItem( TheFirstItem );
  3676.     
  3677.     ItemIndex = FindIndexOfFirstMarkedItem( TheList );
  3678.     
  3679.         if(ItemIndex != (Quad) 0 ) return(3);
  3680.  
  3681.     DeleteList(TheList);
  3682.     
  3683.     PullTheListAndItem();
  3684.     
  3685.     return(False);
  3686. }
  3687.  
  3688. /*------------------------------------------------------------
  3689. | NAME: Test_ExtractMarkedItems
  3690. |
  3691. | PURPOSE: To test the 'ExtractMarkedItems' procedure.
  3692. |
  3693. | DESCRIPTION: Returns non-zero if error detected.
  3694. |
  3695. | EXAMPLE:  
  3696. |
  3697. | NOTE: 
  3698. |
  3699. | ASSUMES: 
  3700. |
  3701. | HISTORY: 11.19.93 by Lee Malone
  3702. |
  3703. ------------------------------------------------------------*/
  3704. Truth
  3705. Test_ExtractMarkedItems()
  3706. {
  3707.     AddressOfList    AList;
  3708.     AddressOfItem    AnItem;
  3709.     
  3710.     PushTheListAndItem();
  3711.     
  3712.     TheList = MakeSampleListOfStaticStrings();
  3713.  
  3714.     AList = ExtractMarkedItems( TheList );
  3715.         if(IsAnyItemsInList(AList)) return(1);
  3716.     DeleteList(AList);
  3717.         
  3718.     MarkItem( TheLastItem );
  3719.     AnItem = TheLastItem;
  3720.     AList = ExtractMarkedItems( TheList );
  3721.         if(GetListItemCount(AList) != (Quad) 1) return(2);
  3722.         if(GetFirstItemOfList(AList) != AnItem ) return(3);
  3723.         if(TheItemCount != (Quad) 2 ) return(4);
  3724.     DeleteList(AList);
  3725.         
  3726.     MarkItem( TheLastItem );
  3727.     AnItem = TheLastItem;
  3728.     AList = ExtractMarkedItems( TheList );
  3729.         if(GetListItemCount(AList) != (Quad) 1) return(5);
  3730.         if(GetFirstItemOfList(AList) != AnItem ) return(6);
  3731.         if(TheItemCount != (Quad) 1 ) return(7);
  3732.     DeleteList(AList);
  3733.     
  3734.     MarkItem( TheLastItem );
  3735.     AnItem = TheLastItem;
  3736.     AList = ExtractMarkedItems( TheList );
  3737.         if(GetListItemCount(AList) != (Quad) 1) return(8);
  3738.         if(GetFirstItemOfList(AList) != AnItem ) return(9);
  3739.         if(TheItemCount != (Quad) 0 ) return(10);
  3740.     DeleteList(AList);
  3741.  
  3742.     DeleteList(TheList);
  3743.     
  3744.     PullTheListAndItem();
  3745.     
  3746.     return(False);
  3747. }
  3748.  
  3749. /*------------------------------------------------------------
  3750. | NAME: Test_DeleteMarkedItems
  3751. |
  3752. | PURPOSE: To test the 'DeleteMarkedItems' procedure.
  3753. |
  3754. | DESCRIPTION: Returns non-zero if error detected.
  3755. |
  3756. | EXAMPLE:  
  3757. |
  3758. | NOTE: 
  3759. |
  3760. | ASSUMES: 
  3761. |
  3762. | HISTORY: 11.19.93 by Lee Malone
  3763. |
  3764. ------------------------------------------------------------*/
  3765. Truth
  3766. Test_DeleteMarkedItems()
  3767. {
  3768.     AddressOfList    AList;
  3769.     AddressOfItem    AnItem;
  3770.     
  3771.     PushTheListAndItem();
  3772.     
  3773.     TheList = MakeSampleListOfStaticStrings();
  3774.  
  3775.     DeleteMarkedItems( TheList );
  3776.         if(TheItemCount != (Quad) 3) return(1);
  3777.         
  3778.     MarkItem( TheLastItem );
  3779.     AnItem = TheLastItem;
  3780.     DeleteMarkedItems( TheList );
  3781.         if(TheItemCount != (Quad) 2 ) return(2);
  3782.         if(TheLastItem == AnItem) return(3);
  3783.         
  3784.     MarkItem( TheLastItem );
  3785.     AnItem = TheLastItem;
  3786.     DeleteMarkedItems( TheList );
  3787.         if(TheItemCount != (Quad) 1 ) return(4);
  3788.         if(TheLastItem == AnItem) return(5);
  3789.  
  3790.     MarkItem( TheLastItem );
  3791.     AnItem = TheLastItem;
  3792.     DeleteMarkedItems( TheList );
  3793.         if(TheItemCount != (Quad) 0 ) return(6);
  3794.         if(TheLastItem == AnItem) return(7);
  3795.         
  3796.     DeleteList(TheList);
  3797.     
  3798.     PullTheListAndItem();
  3799.     
  3800.     return(False);
  3801. }
  3802.  
  3803. /*------------------------------------------------------------
  3804. | NAME: Test_IsAnyItemMarkedInList
  3805. |
  3806. | PURPOSE: To test the 'IsAnyItemMarkedInList' procedure.
  3807. |
  3808. | DESCRIPTION: Returns non-zero if error detected.
  3809. |
  3810. | EXAMPLE:  
  3811. |
  3812. | NOTE: 
  3813. |
  3814. | ASSUMES: 
  3815. |
  3816. | HISTORY: 11.19.93 by Lee Malone
  3817. |
  3818. ------------------------------------------------------------*/
  3819. Truth
  3820. Test_IsAnyItemMarkedInList()
  3821. {
  3822.     AddressOfItem    AnItem;
  3823.     AddressOfItem    LastItem;
  3824.     Truth            Result;
  3825.     
  3826.     PushTheListAndItem();
  3827.     
  3828.     TheList = MakeSampleListOfStaticStrings();
  3829.  
  3830.     Result = IsAnyItemMarkedInList(TheList);
  3831.         if(Result) return(1);
  3832.     
  3833.     MarkItem(TheLastItem);
  3834.  
  3835.     Result = IsAnyItemMarkedInList(TheList);
  3836.         if(!Result) return(1);
  3837.     
  3838.     DeleteList(TheList);
  3839.     
  3840.     PullTheListAndItem();
  3841.     
  3842.     return(False);
  3843. }
  3844.  
  3845. /*------------------------------------------------------------
  3846. | NAME: Test_DuplicateList
  3847. |
  3848. | PURPOSE: To test the 'DuplicateList' procedure.
  3849. |
  3850. | DESCRIPTION: Returns non-zero if error detected.
  3851. |
  3852. | EXAMPLE:  
  3853. |
  3854. | NOTE: 
  3855. |
  3856. | ASSUMES: 
  3857. |
  3858. | HISTORY: 11.19.93 by Lee Malone
  3859. |
  3860. ------------------------------------------------------------*/
  3861. Truth
  3862. Test_DuplicateList()
  3863. {
  3864.     AddressOfList    AList;
  3865.     AddressOfList    BList;
  3866.     AddressOfByte    FirstDataA;
  3867.     AddressOfByte    FirstDataB;
  3868.     AddressOfByte    SecondDataA;
  3869.     AddressOfByte    SecondDataB;
  3870.     AddressOfByte    ThirdDataA;
  3871.     AddressOfByte    ThirdDataB;
  3872.     
  3873.     PushTheListAndItem();
  3874.     
  3875.     AList = MakeSampleListOfStaticStrings();
  3876.  
  3877.     BList = DuplicateList(AList);
  3878.     
  3879.     TheList = AList;
  3880.     FirstDataA  = GetItemDataAddress(TheFirstItem);
  3881.     SecondDataA = GetItemDataAddress(GetNextItem(TheFirstItem));
  3882.     ThirdDataA  = GetItemDataAddress(TheLastItem);
  3883.     
  3884.     TheList = BList;
  3885.     FirstDataB  = GetItemDataAddress(TheFirstItem);
  3886.     SecondDataB = GetItemDataAddress(GetNextItem(TheFirstItem));
  3887.     ThirdDataB  = GetItemDataAddress(TheLastItem);
  3888.     
  3889.         if(FirstDataA  != FirstDataB)  return(1);
  3890.         if(SecondDataA != SecondDataB) return(2);
  3891.         if(ThirdDataA  != ThirdDataB)  return(3);
  3892.         if(GetListItemCount(AList) != GetListItemCount(BList)) 
  3893.                                        return(4);
  3894.     
  3895.     DeleteList(AList);
  3896.     DeleteList(BList);
  3897.         
  3898.     PullTheListAndItem();
  3899.     
  3900.     return(False);
  3901. }
  3902.  
  3903. /*------------------------------------------------------------
  3904. | NAME: Test_DuplicateMarkedItems
  3905. |
  3906. | PURPOSE: To test the 'DuplicateMarkedItems' procedure.
  3907. |
  3908. | DESCRIPTION: Returns non-zero if error detected.
  3909. |
  3910. | EXAMPLE:  
  3911. |
  3912. | NOTE: 
  3913. |
  3914. | ASSUMES: 
  3915. |
  3916. | HISTORY: 11.19.93 by Lee Malone
  3917. |
  3918. ------------------------------------------------------------*/
  3919. Truth
  3920. Test_DuplicateMarkedItems()
  3921. {
  3922.     AddressOfList    AList;
  3923.     AddressOfList    BList;
  3924.     AddressOfByte    FirstDataA;
  3925.     AddressOfByte    FirstDataB;
  3926.     AddressOfByte    LastDataA;
  3927.     AddressOfByte    LastDataB;
  3928.     
  3929.     PushTheListAndItem();
  3930.     
  3931.     AList = MakeSampleListOfStaticStrings();
  3932.  
  3933.     TheList = AList;
  3934.     MarkItem(TheFirstItem);
  3935.     MarkItem(TheLastItem);
  3936.     
  3937.     BList = DuplicateMarkedItems(AList);
  3938.     
  3939.     FirstDataA  = GetItemDataAddress(TheFirstItem);
  3940.     LastDataA   = GetItemDataAddress(TheLastItem);
  3941.     
  3942.     TheList = BList;
  3943.     FirstDataB  = GetItemDataAddress(TheFirstItem);
  3944.     LastDataB   = GetItemDataAddress(TheLastItem);
  3945.     
  3946.         if(FirstDataA != FirstDataB) return(1);
  3947.         if(LastDataA  != LastDataB)  return(2);
  3948.         if(GetListItemCount(BList) != (Quad) 2) return(3);
  3949.     
  3950.     DeleteList(AList);
  3951.     DeleteList(BList);
  3952.         
  3953.     PullTheListAndItem();
  3954.     
  3955.     return(False);
  3956. }
  3957.  
  3958. /*------------------------------------------------------------
  3959. | NAME: Test_ExtractFirstItemFromList
  3960. |
  3961. | PURPOSE: To test the 'ExtractFirstItemFromList' procedure.
  3962. |
  3963. | DESCRIPTION: Returns non-zero if error detected.
  3964. |
  3965. | EXAMPLE:  
  3966. |
  3967. | NOTE: 
  3968. |
  3969. | ASSUMES: 
  3970. |
  3971. | HISTORY: 11.19.93 by Lee Malone
  3972. |
  3973. ------------------------------------------------------------*/
  3974. Truth
  3975. Test_ExtractFirstItemFromList()
  3976. {
  3977.     AddressOfItem    AnItem;
  3978.     AddressOfItem    FirstItem;
  3979.     
  3980.     PushTheListAndItem();
  3981.     
  3982.     TheList = MakeSampleListOfStaticStrings();
  3983.  
  3984.     FirstItem = TheFirstItem;
  3985.     
  3986.     AnItem = ExtractFirstItemFromList(TheList);
  3987.         if(AnItem != FirstItem) return(1);
  3988.     DeleteItem(AnItem);
  3989.     
  3990.     DeleteList(TheList);
  3991.     
  3992.     PullTheListAndItem();
  3993.     
  3994.     return(False);
  3995. }
  3996.  
  3997. /*------------------------------------------------------------
  3998. | NAME: Test_ExtractLastItemFromList
  3999. |
  4000. | PURPOSE: To test the 'ExtractLastItemFromList' procedure.
  4001. |
  4002. | DESCRIPTION: Returns non-zero if error detected.
  4003. |
  4004. | EXAMPLE:  
  4005. |
  4006. | NOTE: 
  4007. |
  4008. | ASSUMES: 
  4009. |
  4010. | HISTORY: 11.19.93 by Lee Malone
  4011. |
  4012. ------------------------------------------------------------*/
  4013. Truth
  4014. Test_ExtractLastItemFromList()
  4015. {
  4016.     AddressOfItem    AnItem;
  4017.     AddressOfItem    LastItem;
  4018.     
  4019.     PushTheListAndItem();
  4020.     
  4021.     TheList = MakeSampleListOfStaticStrings();
  4022.  
  4023.     LastItem = TheLastItem;
  4024.     
  4025.     AnItem = ExtractLastItemFromList(TheList);
  4026.         if(AnItem != LastItem) return(1);
  4027.     DeleteItem(AnItem);
  4028.         
  4029.     DeleteList(TheList);
  4030.     
  4031.     PullTheListAndItem();
  4032.     
  4033.     return(False);
  4034. }
  4035.  
  4036. /*------------------------------------------------------------
  4037. | NAME: Test_ReverseList
  4038. |
  4039. | PURPOSE: To test the 'ReverseList' procedure.
  4040. |
  4041. | DESCRIPTION: Returns non-zero if error detected.
  4042. |
  4043. | EXAMPLE:  
  4044. |
  4045. | NOTE: 
  4046. |
  4047. | ASSUMES: 
  4048. |
  4049. | HISTORY: 11.19.93 by Lee Malone
  4050. |
  4051. ------------------------------------------------------------*/
  4052. Truth
  4053. Test_ReverseList()
  4054. {
  4055.     AddressOfItem    FirstItem;
  4056.     AddressOfItem    MiddleItem;
  4057.     AddressOfItem    LastItem;
  4058.     
  4059.     PushTheListAndItem();
  4060.     
  4061.     TheList = MakeSampleListOfStaticStrings();
  4062.  
  4063.     FirstItem = TheFirstItem;
  4064.     MiddleItem = GetNextItem(TheFirstItem);
  4065.     LastItem = TheLastItem;
  4066.     
  4067.     ReverseList(TheList);
  4068.     
  4069.         if(TheFirstItem != LastItem) return(1);
  4070.         if(TheLastItem != FirstItem) return(2);
  4071.         if(GetNextItem(TheFirstItem) != MiddleItem) return(3);
  4072.         if(TheItemCount != (Quad) 3) return(4);
  4073.     
  4074.     DeleteList(TheList);
  4075.     
  4076.     PullTheListAndItem();
  4077.     
  4078.     return(False);
  4079. }
  4080.  
  4081. /*------------------------------------------------------------
  4082. | NAME: Test_JoinLists
  4083. |
  4084. | PURPOSE: To test the 'JoinLists' procedure.
  4085. |
  4086. | DESCRIPTION: Returns non-zero if error detected.
  4087. |
  4088. | EXAMPLE:  
  4089. |
  4090. | NOTE: 
  4091. |
  4092. | ASSUMES: 
  4093. |
  4094. | HISTORY: 11.19.93 by Lee Malone
  4095. |
  4096. ------------------------------------------------------------*/
  4097. Truth
  4098. Test_JoinLists()
  4099. {
  4100.     AddressOfItem    FirstItem;
  4101.     AddressOfItem    LastItem;
  4102.     AddressOfList    AList;
  4103.     AddressOfList    BList;
  4104.     
  4105.     PushTheListAndItem();
  4106.     
  4107.     AList = MakeSampleListOfStaticStrings();
  4108.     BList = DuplicateList(AList);
  4109.     
  4110.     FirstItem = GetFirstItemOfList(AList);
  4111.     LastItem  = GetLastItemOfList(BList);
  4112.     
  4113.     JoinLists(AList,BList);
  4114.     
  4115.     TheList = AList;
  4116.         if(TheFirstItem != FirstItem) return(1);
  4117.         if(TheLastItem != LastItem)   return(2);
  4118.         if(TheItemCount != (Quad) 6)  return(3);
  4119.         if(IsAnyItemsInList(BList))   return(4);
  4120.         
  4121.     DeleteList(TheList);
  4122.     
  4123.     PullTheListAndItem();
  4124.     
  4125.     return(False);
  4126. }
  4127.  
  4128. /*------------------------------------------------------------
  4129. | NAME: Test_ExchangeItems
  4130. |
  4131. | PURPOSE: To test the 'ExchangeItems' procedure.
  4132. |
  4133. | DESCRIPTION: Returns non-zero if error detected.
  4134. |
  4135. | EXAMPLE:  
  4136. |
  4137. | NOTE: 
  4138. |
  4139. | ASSUMES: 
  4140. |
  4141. | HISTORY: 11.19.93 by Lee Malone
  4142. |
  4143. ------------------------------------------------------------*/
  4144. Truth
  4145. Test_ExchangeItems()
  4146. {
  4147.     AddressOfItem    FirstItem;
  4148.     AddressOfItem    LastItem;
  4149.     AddressOfList    AList;
  4150.     AddressOfList    BList;
  4151.     
  4152.     PushTheListAndItem();
  4153.     
  4154.     AList = MakeSampleListOfStaticStrings();
  4155.     InsertDataLastInList(AList,(AddressOfByte)"DDDD");
  4156.     /* Now 'AList' has four items. */
  4157.     
  4158.     TheList = AList;
  4159.     
  4160.     /* Exchange the first two items, 'AAAA' & 'BBBB'. */
  4161.     ExchangeItems(AList,TheFirstItem,GetNextItem(TheFirstItem));
  4162.     
  4163.     ToFirstItem();
  4164.         if(TheDataAddress != BData) return(1);
  4165.     
  4166.     ToNextItem();
  4167.         if(TheDataAddress != AData) return(2);
  4168.         
  4169.     /* Exchange the what are now the second two items, 
  4170.       'AAAA' & 'CCCC'. */
  4171.     ExchangeItems(AList,TheItem, GetNextItem(TheItem));
  4172.     
  4173.     ToFirstItem();
  4174.     ToNextItem();
  4175.         if(TheDataAddress != CData) return(3);
  4176.     ToNextItem();
  4177.         if(TheDataAddress != AData) return(4);
  4178.     
  4179.     /* Exchange the what are now the last two items, 
  4180.       'AAAA' & 'DDDD'. */
  4181.     ExchangeItems(AList,TheItem, TheLastItem);
  4182.     ToLastItem();
  4183.         if(TheDataAddress != AData) return(5);
  4184.     ToPriorItem();
  4185.         if(TheDataAddress[0] != (Byte) 'D') return(6);
  4186.     
  4187.     DeleteList(TheList);
  4188.     
  4189.     PullTheListAndItem();
  4190.     
  4191.     return(False);
  4192. }
  4193.  
  4194. /*------------------------------------------------------------
  4195. | NAME: Test_InsertItemFirstInList
  4196. |
  4197. | PURPOSE: To test the 'InsertItemFirstInList' procedure.
  4198. |
  4199. | DESCRIPTION: Returns non-zero if error detected.
  4200. |
  4201. | EXAMPLE:  
  4202. |
  4203. | NOTE: 
  4204. |
  4205. | ASSUMES: 
  4206. |
  4207. | HISTORY: 11.19.93 by Lee Malone
  4208. |
  4209. ------------------------------------------------------------*/
  4210. Truth
  4211. Test_InsertItemFirstInList()
  4212. {
  4213.     AddressOfItem    FirstItem;
  4214.     AddressOfItem    SecondItem;
  4215.     AddressOfByte    SomeData;
  4216.     
  4217.     PushTheListAndItem();
  4218.     
  4219.     TheList = CreateList();
  4220.  
  4221.     SomeData = (AddressOfByte) "Existence is identity.";
  4222.     FirstItem = CreateItemForData(SomeData);
  4223.     InsertItemFirstInList(TheList,FirstItem);
  4224.     
  4225.         if(TheItemCount != 1)             return(1);
  4226.         if(TheFirstItem != FirstItem)     return(2);
  4227.         if(TheLastItem  != FirstItem)     return(3);
  4228.  
  4229.     SomeData = (AddressOfByte) "Consciousness is identification.";
  4230.     SecondItem = CreateItemForData(SomeData);
  4231.     InsertItemFirstInList(TheList,SecondItem);
  4232.     
  4233.         if(TheItemCount != 2)                         return(4);
  4234.         if(TheLastItem != FirstItem)                 return(5);
  4235.         if(TheFirstItem != SecondItem)                 return(6);
  4236.         if(GetNextItem(SecondItem) != FirstItem)     return(7);
  4237.         if(GetPriorItem(FirstItem) != SecondItem)     return(8);
  4238.         
  4239.     DeleteList(TheList); 
  4240.  
  4241.     PullTheListAndItem();
  4242.  
  4243.     return(False);
  4244. }
  4245.  
  4246. /*------------------------------------------------------------
  4247. | NAME: Test_InsertItemAfterItemInList
  4248. |
  4249. | PURPOSE: To test the 'InsertItemAfterItemInList' procedure.
  4250. |
  4251. | DESCRIPTION: Returns non-zero if error detected.
  4252. |
  4253. | EXAMPLE:  
  4254. |
  4255. | NOTE: 
  4256. |
  4257. | ASSUMES: 
  4258. |
  4259. | HISTORY: 11.19.93 by Lee Malone
  4260. |
  4261. ------------------------------------------------------------*/
  4262. Truth
  4263. Test_InsertItemAfterItemInList()
  4264. {
  4265.     Byte             DData[]="DDDD";
  4266.     AddressOfList    AList;
  4267.     AddressOfItem    AnItem;
  4268.     
  4269.     PushTheListAndItem();
  4270.     
  4271.     AList = MakeSampleListOfStaticStrings();
  4272.     TheList = AList;
  4273.     AnItem = CreateItemForData(DData);
  4274.     InsertItemAfterItemInList(AList,TheFirstItem,AnItem);
  4275.     /* Now 'AList' has four items:
  4276.        {'AAAA','DDDD','BBBB','CCCC'}
  4277.     */
  4278.  
  4279.         if(TheItemCount != 4)    return(1);
  4280.  
  4281.     ToFirstItem();
  4282.     ToNextItem();
  4283.         if(TheItem != AnItem) return(2);
  4284.         
  4285.     ToPriorItem();
  4286.         if(TheItem != TheFirstItem) return(3);
  4287.         
  4288.     AnItem = CreateItemForData(DData);
  4289.     InsertItemAfterItemInList(AList,TheLastItem,AnItem);
  4290.     /* Now 'AList' has five items:
  4291.        {'AAAA','DDDD','BBBB','CCCC','DDDD'}
  4292.     */
  4293.     ToLastItem();
  4294.         if(TheItem != AnItem) return(4);
  4295.     ToPriorItem();
  4296.         if(TheDataAddress != CData) return(5);
  4297.     ToNextItem();
  4298.         if(TheItem != AnItem) return(6);
  4299.  
  4300.     AnItem = CreateItemForData(DData);
  4301.     InsertItemAfterItemInList(AList,(AddressOfItem)0,AnItem);
  4302.     /* Now 'AList' has six items:
  4303.        {'DDDD','AAAA','DDDD','BBBB','CCCC','DDDD'}
  4304.     */
  4305.     ToFirstItem();
  4306.         if(TheItem != AnItem) return(7);
  4307.     ToNextItem();
  4308.         if(TheDataAddress != AData) return(8);
  4309.     ToPriorItem();
  4310.         if(TheItem != AnItem) return(9);
  4311.  
  4312.     DeleteList(TheList); 
  4313.  
  4314.     PullTheListAndItem();
  4315.  
  4316.     return(False);
  4317. }
  4318.  
  4319. /*------------------------------------------------------------
  4320. | NAME: Test_InsertItemBeforeItemInList
  4321. |
  4322. | PURPOSE: To test the 'InsertItemBeforeItemInList' procedure.
  4323. |
  4324. | DESCRIPTION: Returns non-zero if error detected.
  4325. |
  4326. | EXAMPLE:  
  4327. |
  4328. | NOTE: 
  4329. |
  4330. | ASSUMES: 
  4331. |
  4332. | HISTORY: 11.19.93 by Lee Malone
  4333. |
  4334. ------------------------------------------------------------*/
  4335. Truth
  4336. Test_InsertItemBeforeItemInList()
  4337. {
  4338.     Byte             DData[]="DDDD";
  4339.     AddressOfItem    AnItem;
  4340.     AddressOfList    AList;
  4341.     
  4342.     PushTheListAndItem();
  4343.     
  4344.     AList = MakeSampleListOfStaticStrings();
  4345.     TheList = AList;
  4346.     AnItem = CreateItemForData(DData);
  4347.     InsertItemBeforeItemInList(AList,TheLastItem,AnItem);
  4348.     /* Now 'AList' has four items:
  4349.        {'AAAA','BBBB','DDDD','CCCC'}
  4350.     */
  4351.  
  4352.         if(TheItemCount != 4)    return(1);
  4353.  
  4354.     ToLastItem();
  4355.     ToPriorItem();
  4356.         if(TheItem != AnItem) return(2);
  4357.         
  4358.     ToNextItem();
  4359.         if(TheItem != TheLastItem) return(3);
  4360.         
  4361.     AnItem = CreateItemForData(DData);
  4362.     InsertItemBeforeItemInList(AList,TheFirstItem,AnItem);
  4363.     /* Now 'AList' has five items:
  4364.        {'DDDD','AAAA','BBBB','DDDD','CCCC'}
  4365.     */
  4366.     ToFirstItem();
  4367.         if(TheItem != AnItem) return(4);
  4368.     ToNextItem();
  4369.         if(TheDataAddress != AData) return(5);
  4370.     ToPriorItem();
  4371.         if(TheItem != AnItem) return(6);
  4372.     
  4373.     AnItem = CreateItemForData(DData);
  4374.     InsertItemBeforeItemInList(AList,(AddressOfItem) 0,AnItem);
  4375.     /* Now 'AList' has six items:
  4376.        {'DDDD','AAAA','BBBB','DDDD','CCCC','DDDD'}
  4377.     */
  4378.     ToLastItem();
  4379.         if(TheItem != AnItem) return(7);
  4380.     ToPriorItem();
  4381.         if(TheDataAddress != CData) return(8);
  4382.     ToNextItem();
  4383.         if(TheItem != AnItem) return(9);
  4384.     
  4385.     DeleteList(TheList); 
  4386.  
  4387.     PullTheListAndItem();
  4388.  
  4389.     return(False);
  4390. }
  4391.  
  4392. /*------------------------------------------------------------
  4393. | NAME: Test_InsertDataFirstInList
  4394. |
  4395. | PURPOSE: To test the 'InsertDataFirstInList' procedure.
  4396. |
  4397. | DESCRIPTION: Returns non-zero if error detected.
  4398. |
  4399. | EXAMPLE:  
  4400. |
  4401. | NOTE: 
  4402. |
  4403. | ASSUMES: 
  4404. |
  4405. | HISTORY: 11.19.93 by Lee Malone
  4406. |
  4407. ------------------------------------------------------------*/
  4408. Truth
  4409. Test_InsertDataFirstInList()
  4410. {
  4411.     AddressOfItem    FirstItem;
  4412.     AddressOfItem    SecondItem;
  4413.     AddressOfByte    SomeData;
  4414.     
  4415.     PushTheListAndItem();
  4416.     
  4417.     TheList = CreateList();
  4418.  
  4419.     SomeData = (AddressOfByte) "Existence is identity.";
  4420.     InsertDataFirstInList(TheList, SomeData);
  4421.     
  4422.     ToFirstItem();
  4423.         if(TheDataAddress != SomeData) return(1);
  4424.                 
  4425.     DeleteList(TheList); 
  4426.  
  4427.     PullTheListAndItem();
  4428.  
  4429.     return(False);
  4430. }
  4431.  
  4432. /*------------------------------------------------------------
  4433. | NAME: Test_InsertDataAfterItemInList
  4434. |
  4435. | PURPOSE: To test the 'InsertDataAfterItemInList' procedure.
  4436. |
  4437. | DESCRIPTION: Returns non-zero if error detected.
  4438. |
  4439. | EXAMPLE:  
  4440. |
  4441. | NOTE: 
  4442. |
  4443. | ASSUMES: 
  4444. |
  4445. | HISTORY: 11.19.93 by Lee Malone
  4446. |
  4447. ------------------------------------------------------------*/
  4448. Truth
  4449. Test_InsertDataAfterItemInList()
  4450. {
  4451.     Byte             DData[]="DDDD";
  4452.     AddressOfList    AList;
  4453.     
  4454.     PushTheListAndItem();
  4455.     
  4456.     AList = MakeSampleListOfStaticStrings();
  4457.     TheList = AList;
  4458.     
  4459.     InsertDataAfterItemInList(AList,TheFirstItem,DData);
  4460.     /* Now 'AList' has four items:
  4461.        {'AAAA','DDDD','BBBB','CCCC'}
  4462.     */
  4463.  
  4464.     ToFirstItem();
  4465.     ToNextItem();
  4466.         if(TheDataAddress != DData) return(1);
  4467.         
  4468.     InsertDataAfterItemInList(AList,TheLastItem,DData);
  4469.     /* Now 'AList' has five items:
  4470.        {'AAAA','DDDD','BBBB','CCCC','DDDD'}
  4471.     */
  4472.     ToLastItem();
  4473.         if(TheDataAddress != DData) return(2);
  4474.  
  4475.     DeleteList(TheList); 
  4476.  
  4477.     PullTheListAndItem();
  4478.  
  4479.     return(False);
  4480. }
  4481.  
  4482. /*------------------------------------------------------------
  4483. | NAME: Test_InsertDataBeforeItemInList
  4484. |
  4485. | PURPOSE: To test the 'InsertDataBeforeItemInList' procedure.
  4486. |
  4487. | DESCRIPTION: Returns non-zero if error detected.
  4488. |
  4489. | EXAMPLE:  
  4490. |
  4491. | NOTE: 
  4492. |
  4493. | ASSUMES: 
  4494. |
  4495. | HISTORY: 11.19.93 by Lee Malone
  4496. |
  4497. ------------------------------------------------------------*/
  4498. Truth
  4499. Test_InsertDataBeforeItemInList()
  4500. {
  4501.     Byte             DData[]="DDDD";
  4502.     AddressOfList    AList;
  4503.     
  4504.     PushTheListAndItem();
  4505.     
  4506.     AList = MakeSampleListOfStaticStrings();
  4507.     TheList = AList;
  4508.     
  4509.     InsertDataBeforeItemInList(AList,TheLastItem,DData);
  4510.     /* Now 'AList' has four items:
  4511.        {'AAAA','BBBB','DDDD','CCCC'}
  4512.     */
  4513.  
  4514.     ToLastItem();
  4515.     ToPriorItem();
  4516.         if(TheDataAddress != DData) return(1);
  4517.         
  4518.     InsertDataBeforeItemInList(AList,TheFirstItem,DData);
  4519.     /* Now 'AList' has five items:
  4520.        {'DDDD','AAAA','BBBB','DDDD','CCCC'}
  4521.     */
  4522.     ToFirstItem();
  4523.         if(TheDataAddress != DData) return(2);
  4524.     
  4525.     DeleteList(TheList); 
  4526.  
  4527.     PullTheListAndItem();
  4528.  
  4529.     return(False);
  4530. }
  4531.  
  4532. /*------------------------------------------------------------
  4533. | NAME: Test_BuildDirectAccessTableForList
  4534. |
  4535. | PURPOSE: To test the 'BuildDirectAccessTableForList' 
  4536. |          procedure.
  4537. |
  4538. | DESCRIPTION: Returns non-zero if error detected.
  4539. |
  4540. | EXAMPLE:  
  4541. |
  4542. | NOTE: 
  4543. |
  4544. | ASSUMES: 
  4545. |
  4546. | HISTORY: 11.19.93 by Lee Malone
  4547. |
  4548. ------------------------------------------------------------*/
  4549. Truth
  4550. Test_BuildDirectAccessTableForList()
  4551. {
  4552.     AddressOfList           AList;
  4553.     AddressOfAddressOfItem ATable;
  4554.     
  4555.     
  4556.     PushTheListAndItem();
  4557.     
  4558.     AList  = MakeSampleListOfStaticStrings();
  4559.     ATable = BuildDirectAccessTableForList(AList);
  4560.     
  4561.     TheList = AList;
  4562.     ToFirstItem();
  4563.         if(TheItem != ATable[0]) return(1);
  4564.  
  4565.     ToNextItem();
  4566.         if(TheItem != ATable[1]) return(2);
  4567.  
  4568.     ToNextItem();
  4569.         if(TheItem != ATable[2]) return(3);
  4570.         
  4571.     FreeMemory(ATable);
  4572.     
  4573.     DeleteList(TheList); 
  4574.  
  4575.     PullTheListAndItem();
  4576.  
  4577.     return(False);
  4578. }
  4579.  
  4580. /*------------------------------------------------------------
  4581. | NAME: Test_FindPlaceInOrderedList
  4582. |
  4583. | PURPOSE: To test the 'FindPlaceInOrderedList' 
  4584. |          procedure.
  4585. |
  4586. | DESCRIPTION: Returns non-zero if error detected.
  4587. |
  4588. | EXAMPLE:  
  4589. |
  4590. | NOTE: 
  4591. |
  4592. | ASSUMES: 
  4593. |
  4594. | HISTORY: 11.21.93 by Lee Malone
  4595. |
  4596. ------------------------------------------------------------*/
  4597. Truth
  4598. Test_FindPlaceInOrderedList()
  4599. {
  4600.     AddressOfList    AList;
  4601.     AddressOfItem    AnItem;
  4602.     
  4603.     
  4604.     PushTheListAndItem();
  4605.     
  4606.     AList  = MakeSampleListOfStaticStrings();
  4607.  
  4608.     TheList = AList;
  4609.  
  4610.     AnItem = FindPlaceInOrderedList(AList,
  4611.                               (AddressOfByte) "A",
  4612.                               CompareStrings);
  4613.                               
  4614.     ToFirstItem();
  4615.         if(AnItem != TheItem ) return(1);
  4616.  
  4617.     AnItem = FindPlaceInOrderedList(AList,
  4618.                               (AddressOfByte) "B",
  4619.                               CompareStrings);
  4620.                               
  4621.     ToNextItem();
  4622.         if(AnItem != TheItem) return(2);
  4623.  
  4624.     AnItem = FindPlaceInOrderedList(AList,
  4625.                               (AddressOfByte) "C",
  4626.                               CompareStrings);
  4627.                               
  4628.     ToNextItem();
  4629.         if(AnItem  != TheItem) return(3);
  4630.         
  4631.     AnItem = FindPlaceInOrderedList(AList,
  4632.                               (AddressOfByte) "D",
  4633.                               CompareStrings);
  4634.                               
  4635.         if(AnItem != (AddressOfItem) 0) return(4);
  4636.  
  4637.     DeleteList(TheList); 
  4638.  
  4639.     PullTheListAndItem();
  4640.  
  4641.     return(False);
  4642. }
  4643.  
  4644. /*------------------------------------------------------------
  4645. | NAME: Test_InsertDataInOrderedList
  4646. |
  4647. | PURPOSE: To test the 'InsertDataInOrderedList' 
  4648. |          procedure.
  4649. |
  4650. | DESCRIPTION: Returns non-zero if error detected.
  4651. |
  4652. | EXAMPLE:  
  4653. |
  4654. | NOTE: 
  4655. |
  4656. | ASSUMES: 
  4657. |
  4658. | HISTORY: 11.21.93 by Lee Malone
  4659. |
  4660. ------------------------------------------------------------*/
  4661. Truth
  4662. Test_InsertDataInOrderedList()
  4663. {
  4664.     AddressOfList    AList;
  4665.     AddressOfItem    AnItem;
  4666.     
  4667.     
  4668.     PushTheListAndItem();
  4669.     
  4670.     AList  = MakeSampleListOfStaticStrings();
  4671.     
  4672.     /* This is what the list looks like: */
  4673.     /* { 'AAAA', 'BBBB', 'CCCC' }        */
  4674.  
  4675.     TheList = AList;
  4676.  
  4677.     AnItem = InsertDataInOrderedList(AList,
  4678.                               (AddressOfByte) "A",
  4679.                               CompareStrings);
  4680.     /* { 'A', 'AAAA', 'BBBB', 'CCCC' } */
  4681.                               
  4682.     ToFirstItem();
  4683.         if(AnItem != TheItem ) return(1);
  4684.  
  4685.     AnItem = InsertDataInOrderedList(AList,
  4686.                               (AddressOfByte) "B",
  4687.                               CompareStrings);
  4688.                               
  4689.     /* { 'A', 'AAAA', 'B', 'BBBB', 'CCCC' } */
  4690.     ToFirstItem();
  4691.     ToNextItem();
  4692.     ToNextItem();
  4693.         if(AnItem != TheItem) return(2);
  4694.  
  4695.     AnItem = InsertDataInOrderedList(AList,
  4696.                               (AddressOfByte) "C",
  4697.                               CompareStrings);
  4698.  
  4699.     /* { 'A', 'AAAA', 'B', 'BBBB', 'C', 'CCCC' } */
  4700.                               
  4701.     ToFirstItem();
  4702.     ToNextItem();
  4703.     ToNextItem();
  4704.     ToNextItem();
  4705.     ToNextItem();
  4706.         if(AnItem  != TheItem) return(3);
  4707.         
  4708.     AnItem = InsertDataInOrderedList(AList,
  4709.                               (AddressOfByte) "D",
  4710.                               CompareStrings);
  4711.     /* { 'A', 'AAAA', 'B', 'BBBB', 'C', 'CCCC','D'  } */
  4712.                               
  4713.                               
  4714.     ToLastItem();
  4715.         if(AnItem != AnItem) return(4);
  4716.  
  4717.     DeleteList(TheList); 
  4718.  
  4719.     PullTheListAndItem();
  4720.  
  4721.     return(False);
  4722. }
  4723.  
  4724. /*------------------------------------------------------------
  4725. | NAME: Test_FindPlaceInOrderedDirectAccessTable
  4726. |
  4727. | PURPOSE: To test the 'FindPlaceInOrderedDirectAccessTable' 
  4728. |          procedure.
  4729. |
  4730. | DESCRIPTION: Returns non-zero if error detected.
  4731. |
  4732. | EXAMPLE:  
  4733. |
  4734. | NOTE: 
  4735. |
  4736. | ASSUMES: 
  4737. |
  4738. | HISTORY: 11.21.93 by Lee Malone
  4739. |
  4740. ------------------------------------------------------------*/
  4741. Truth
  4742. Test_FindPlaceInOrderedDirectAccessTable()
  4743. {
  4744.     AddressOfList    AList;
  4745.     AddressOfItem    AnItem;
  4746.     AddressOfAddressOfItem ATable;
  4747.     AddressOfAddressOfItem AnEntry;
  4748.     
  4749.     
  4750.     PushTheListAndItem();
  4751.     
  4752.     AList  = MakeSampleListOfStaticStrings();
  4753.     ATable = BuildDirectAccessTableForList(AList);
  4754.  
  4755.     TheList = AList;
  4756.  
  4757.     AnEntry = FindPlaceInOrderedDirectAccessTable(
  4758.                     ATable,
  4759.                     (Quad) TheItemCount,
  4760.                     (AddressOfByte) "A",
  4761.                     CompareStrings);
  4762.                               
  4763.         if(AnEntry != &ATable[0] ) return(1);
  4764.  
  4765.     AnEntry = FindPlaceInOrderedDirectAccessTable(
  4766.                     ATable,
  4767.                     (Quad) TheItemCount,
  4768.                     (AddressOfByte) "B",
  4769.                     CompareStrings);
  4770.                               
  4771.         if(AnEntry != &ATable[1] ) return(2);
  4772.  
  4773.     AnEntry = FindPlaceInOrderedDirectAccessTable(
  4774.                     ATable,
  4775.                     (Quad) TheItemCount,
  4776.                     (AddressOfByte) "C",
  4777.                     CompareStrings);
  4778.                               
  4779.         if(AnEntry != &ATable[2] ) return(3);
  4780.  
  4781.         
  4782.     AnEntry = FindPlaceInOrderedDirectAccessTable(
  4783.                     ATable,
  4784.                     (Quad) TheItemCount,
  4785.                     (AddressOfByte) "D",
  4786.                     CompareStrings);
  4787.                               
  4788.         if(AnEntry != (AddressOfAddressOfItem) 0 ) return(4);
  4789.  
  4790.     FreeMemory(ATable);
  4791.  
  4792.     DeleteList(TheList); 
  4793.  
  4794.     PullTheListAndItem();
  4795.  
  4796.     return(False);
  4797. }
  4798.  
  4799. /*------------------------------------------------------------
  4800. | NAME: Test_ReorderListToMatchDirectAccessTable
  4801. |
  4802. | PURPOSE: To test the 'ReorderListToMatchDirectAccessTable' 
  4803. |          procedure.
  4804. |
  4805. | DESCRIPTION: Returns non-zero if error detected.
  4806. |
  4807. | EXAMPLE:  
  4808. |
  4809. | NOTE: 
  4810. |
  4811. | ASSUMES: 
  4812. |
  4813. | HISTORY: 11.21.93 by Lee Malone
  4814. |
  4815. ------------------------------------------------------------*/
  4816. Truth
  4817. Test_ReorderListToMatchDirectAccessTable()
  4818. {
  4819.     AddressOfList    AList;
  4820.     AddressOfAddressOfItem ATable;
  4821.     
  4822.     PushTheListAndItem();
  4823.     
  4824.     AList  = MakeSampleListOfStaticStrings();
  4825.     ATable = BuildDirectAccessTableForList(AList);
  4826.  
  4827.     ReverseList(AList);
  4828.     
  4829.     ReorderListToMatchDirectAccessTable( AList, ATable);
  4830.  
  4831.     TheList = AList;
  4832.     
  4833.     ToFirstItem();
  4834.         if(TheDataAddress != AData) return(1);
  4835.     ToNextItem();
  4836.         if(TheDataAddress != BData) return(2);
  4837.     ToNextItem();
  4838.         if(TheDataAddress != CData) return(3);
  4839.  
  4840.     ToLastItem();
  4841.         if(TheDataAddress != CData) return(4);
  4842.     ToPriorItem();
  4843.         if(TheDataAddress != BData) return(5);
  4844.     ToPriorItem();
  4845.         if(TheDataAddress != AData) return(6);
  4846.     
  4847.     FreeMemory(ATable);
  4848.  
  4849.     DeleteList(TheList); 
  4850.  
  4851.     PullTheListAndItem();
  4852.  
  4853.     return(False);
  4854. }
  4855.  
  4856. /*------------------------------------------------------------
  4857. | NAME: Test_SortShortList
  4858. |
  4859. | PURPOSE: To test the 'SortShortList' 
  4860. |          procedure.
  4861. |
  4862. | DESCRIPTION: Returns non-zero if error detected.
  4863. |
  4864. | EXAMPLE:  
  4865. |
  4866. | NOTE: 
  4867. |
  4868. | ASSUMES: 
  4869. |
  4870. | HISTORY: 11.21.93 by Lee Malone
  4871. |
  4872. ------------------------------------------------------------*/
  4873. Truth
  4874. Test_SortShortList()
  4875. {
  4876.     AddressOfList    AList;
  4877.     
  4878.     PushTheListAndItem();
  4879.     
  4880.     AList  = MakeSampleListOfStaticStrings();
  4881.  
  4882.     ReverseList(AList);
  4883.     
  4884.     SortShortList(AList,CompareStrings);
  4885.  
  4886.     TheList = AList;
  4887.     
  4888.     ToFirstItem();
  4889.         if(TheDataAddress != AData) return(1);
  4890.     ToNextItem();
  4891.         if(TheDataAddress != BData) return(2);
  4892.     ToNextItem();
  4893.         if(TheDataAddress != CData) return(3);
  4894.  
  4895.     ToLastItem();
  4896.         if(TheDataAddress != CData) return(4);
  4897.     ToPriorItem();
  4898.         if(TheDataAddress != BData) return(5);
  4899.     ToPriorItem();
  4900.         if(TheDataAddress != AData) return(6);
  4901.     
  4902.     DeleteList(TheList); 
  4903.  
  4904.     PullTheListAndItem();
  4905.  
  4906.     return(False);
  4907. }
  4908.  
  4909. /*------------------------------------------------------------
  4910. | NAME: Test_SortDirectAccessTable
  4911. |
  4912. | PURPOSE: To test the 'SortDirectAccessTable' 
  4913. |          procedure.
  4914. |
  4915. | DESCRIPTION: Returns non-zero if error detected.
  4916. |
  4917. | EXAMPLE:  
  4918. |
  4919. | NOTE: 
  4920. |
  4921. | ASSUMES: 
  4922. |
  4923. | HISTORY: 11.21.93 by Lee Malone
  4924. |
  4925. ------------------------------------------------------------*/
  4926. Truth
  4927. Test_SortDirectAccessTable()
  4928. {
  4929.     AddressOfList AList;
  4930.     AddressOfItem DATable[] = {0,0,0,0,0};
  4931.     AddressOfAddressOfItem ATable;
  4932.     
  4933.     PushTheListAndItem();
  4934.     
  4935.     ATable = &DATable[1];
  4936.     
  4937.     AList  = MakeSampleListOfStaticStrings();
  4938.     ReverseList(AList);
  4939.     
  4940.     TheList = AList;
  4941.     ToFirstItem();
  4942.     DATable[1] = TheItem;
  4943.     ToNextItem();
  4944.     DATable[2] = TheItem;
  4945.     ToNextItem();
  4946.     DATable[3] = TheItem;
  4947.     
  4948.     SortDirectAccessTable( ATable, 
  4949.                            (Quad) 3, 
  4950.                            CompareStrings);
  4951.  
  4952.     ReorderListToMatchDirectAccessTable(AList, ATable);
  4953.  
  4954.     ToFirstItem();
  4955.         if(TheDataAddress != AData) return(1);
  4956.     ToNextItem();
  4957.         if(TheDataAddress != BData) return(2);
  4958.     ToNextItem();
  4959.         if(TheDataAddress != CData) return(3);
  4960.  
  4961.     ToLastItem();
  4962.         if(TheDataAddress != CData) return(4);
  4963.     ToPriorItem();
  4964.         if(TheDataAddress != BData) return(5);
  4965.     ToPriorItem();
  4966.         if(TheDataAddress != AData) return(6);
  4967.     
  4968.         if(DATable[0] != (AddressOfItem) 0) return(7);
  4969.         if(DATable[4] != (AddressOfItem) 0) return(8);
  4970.         
  4971.     DeleteList(TheList); 
  4972.  
  4973.     PullTheListAndItem();
  4974.  
  4975.     return(False);
  4976. }
  4977.  
  4978. /*------------------------------------------------------------
  4979. | NAME: Test_SortListViaDirectAccessTable
  4980. |
  4981. | PURPOSE: To test the 'SortListViaDirectAccessTable' 
  4982. |          procedure.
  4983. |
  4984. | DESCRIPTION: Returns non-zero if error detected.
  4985. |
  4986. | EXAMPLE:  
  4987. |
  4988. | NOTE: 
  4989. |
  4990. | ASSUMES: 
  4991. |
  4992. | HISTORY: 11.21.93 by Lee Malone
  4993. |
  4994. ------------------------------------------------------------*/
  4995. Truth
  4996. Test_SortListViaDirectAccessTable()
  4997. {
  4998.     AddressOfList    AList;
  4999.     
  5000.     PushTheListAndItem();
  5001.     
  5002.     AList  = MakeSampleListOfStaticStrings();
  5003.  
  5004.     ReverseList(AList);
  5005.     
  5006.     SortListViaDirectAccessTable(AList,CompareStrings);
  5007.  
  5008.     TheList = AList;
  5009.     
  5010.     ToFirstItem();
  5011.         if(TheDataAddress != AData) return(1);
  5012.     ToNextItem();
  5013.         if(TheDataAddress != BData) return(2);
  5014.     ToNextItem();
  5015.         if(TheDataAddress != CData) return(3);
  5016.  
  5017.     ToLastItem();
  5018.         if(TheDataAddress != CData) return(4);
  5019.     ToPriorItem();
  5020.         if(TheDataAddress != BData) return(5);
  5021.     ToPriorItem();
  5022.         if(TheDataAddress != AData) return(6);
  5023.     
  5024.     DeleteList(TheList); 
  5025.  
  5026.     PullTheListAndItem();
  5027.  
  5028.     return(False);
  5029. }
  5030.  
  5031. /*------------------------------------------------------------
  5032. | NAME: Test_SortList
  5033. |
  5034. | PURPOSE: To test the 'SortList' procedure.
  5035. |
  5036. | DESCRIPTION: Returns non-zero if error detected.
  5037. |
  5038. | EXAMPLE:  
  5039. |
  5040. | NOTE: 
  5041. |
  5042. | ASSUMES: 
  5043. |
  5044. | HISTORY: 11.22.93 by Lee Malone
  5045. |
  5046. ------------------------------------------------------------*/
  5047. Truth
  5048. Test_SortList()
  5049. {
  5050.     AddressOfList    AList;
  5051.     
  5052.     PushTheListAndItem();
  5053.     
  5054.     AList  = MakeSampleListOfStaticStrings();
  5055.  
  5056.     ReverseList(AList);
  5057.     
  5058.     DirectAccessTableThreshold = 20;
  5059.     /* Use SortShortList(). */
  5060.     SortList(AList,CompareStrings);
  5061.  
  5062.     TheList = AList;
  5063.     
  5064.     ToFirstItem();
  5065.         if(TheDataAddress != AData) return(1);
  5066.     ToNextItem();
  5067.         if(TheDataAddress != BData) return(2);
  5068.     ToNextItem();
  5069.         if(TheDataAddress != CData) return(3);
  5070.  
  5071.     ToLastItem();
  5072.         if(TheDataAddress != CData) return(4);
  5073.     ToPriorItem();
  5074.         if(TheDataAddress != BData) return(5);
  5075.     ToPriorItem();
  5076.         if(TheDataAddress != AData) return(6);
  5077.     
  5078.     ReverseList(AList);
  5079.     
  5080.     DirectAccessTableThreshold = 2;
  5081.     /* Use SortListViaDirectAccessTable(). */
  5082.     SortList(AList,CompareStrings);
  5083.  
  5084.     TheList = AList;
  5085.     
  5086.     ToFirstItem();
  5087.         if(TheDataAddress != AData) return(1);
  5088.     ToNextItem();
  5089.         if(TheDataAddress != BData) return(2);
  5090.     ToNextItem();
  5091.         if(TheDataAddress != CData) return(3);
  5092.  
  5093.     ToLastItem();
  5094.         if(TheDataAddress != CData) return(4);
  5095.     ToPriorItem();
  5096.         if(TheDataAddress != BData) return(5);
  5097.     ToPriorItem();
  5098.         if(TheDataAddress != AData) return(6);
  5099.     
  5100.     DeleteList(TheList); 
  5101.  
  5102.     PullTheListAndItem();
  5103.  
  5104.     return(False);
  5105. }
  5106.  
  5107. /*------------------------------------------------------------
  5108. | NAME: Test_SortListAlphabetically
  5109. |
  5110. | PURPOSE: To test the 'SortListAlphabetically' procedure.
  5111. |
  5112. | DESCRIPTION: Returns non-zero if error detected.
  5113. |
  5114. | EXAMPLE:  
  5115. |
  5116. | NOTE: 
  5117. |
  5118. | ASSUMES: 
  5119. |
  5120. | HISTORY: 11.22.93 by Lee Malone
  5121. |
  5122. ------------------------------------------------------------*/
  5123. Truth
  5124. Test_SortListAlphabetically()
  5125. {
  5126.     AddressOfList    AList;
  5127.     
  5128.     PushTheListAndItem();
  5129.     
  5130.     AList  = MakeSampleListOfStaticStrings();
  5131.  
  5132.     ReverseList(AList);
  5133.     
  5134.     DirectAccessTableThreshold = 20;
  5135.     /* Use SortShortList(). */
  5136.     SortListAlphabetically(AList);
  5137.  
  5138.     TheList = AList;
  5139.     
  5140.     ToFirstItem();
  5141.         if(TheDataAddress != AData) return(1);
  5142.     ToNextItem();
  5143.         if(TheDataAddress != BData) return(2);
  5144.     ToNextItem();
  5145.         if(TheDataAddress != CData) return(3);
  5146.  
  5147.     ToLastItem();
  5148.         if(TheDataAddress != CData) return(4);
  5149.     ToPriorItem();
  5150.         if(TheDataAddress != BData) return(5);
  5151.     ToPriorItem();
  5152.         if(TheDataAddress != AData) return(6);
  5153.     
  5154.     ReverseList(AList);
  5155.     
  5156.     DirectAccessTableThreshold = 2;
  5157.     /* Use SortListViaDirectAccessTable(). */
  5158.     SortListAlphabetically(AList);
  5159.  
  5160.     TheList = AList;
  5161.     
  5162.     ToFirstItem();
  5163.         if(TheDataAddress != AData) return(1);
  5164.     ToNextItem();
  5165.         if(TheDataAddress != BData) return(2);
  5166.     ToNextItem();
  5167.         if(TheDataAddress != CData) return(3);
  5168.  
  5169.     ToLastItem();
  5170.         if(TheDataAddress != CData) return(4);
  5171.     ToPriorItem();
  5172.         if(TheDataAddress != BData) return(5);
  5173.     ToPriorItem();
  5174.         if(TheDataAddress != AData) return(6);
  5175.     
  5176.     DeleteList(TheList); 
  5177.  
  5178.     PullTheListAndItem();
  5179.  
  5180.     return(False);
  5181. }
  5182.  
  5183. /*------------------------------------------------------------
  5184. | NAME: Test_SortListDescending
  5185. |
  5186. | PURPOSE: To test the 'SortListDescending' procedure.
  5187. |
  5188. | DESCRIPTION: Returns non-zero if error detected.
  5189. |
  5190. | EXAMPLE:  
  5191. |
  5192. | NOTE: 
  5193. |
  5194. | ASSUMES: 
  5195. |
  5196. | HISTORY: 11.22.93 by Lee Malone
  5197. |
  5198. ------------------------------------------------------------*/
  5199. Truth
  5200. Test_SortListDescending()
  5201. {
  5202.     AddressOfList    AList;
  5203.     
  5204.     PushTheListAndItem();
  5205.     
  5206.     AList  = MakeSampleListOfStaticStrings();
  5207.  
  5208.     DirectAccessTableThreshold = 20;
  5209.     /* Use SortShortList(). */
  5210.     SortListDescending(AList,CompareStrings);
  5211.  
  5212.     ReverseList(AList);
  5213.     
  5214.     TheList = AList;
  5215.     
  5216.     ToFirstItem();
  5217.         if(TheDataAddress != AData) return(1);
  5218.     ToNextItem();
  5219.         if(TheDataAddress != BData) return(2);
  5220.     ToNextItem();
  5221.         if(TheDataAddress != CData) return(3);
  5222.  
  5223.     ToLastItem();
  5224.         if(TheDataAddress != CData) return(4);
  5225.     ToPriorItem();
  5226.         if(TheDataAddress != BData) return(5);
  5227.     ToPriorItem();
  5228.         if(TheDataAddress != AData) return(6);
  5229.     
  5230.     DirectAccessTableThreshold = 2;
  5231.     /* Use SortListViaDirectAccessTable(). */
  5232.     SortListDescending(AList,CompareStrings);
  5233.  
  5234.     ReverseList(AList);
  5235.     
  5236.     TheList = AList;
  5237.     
  5238.     ToFirstItem();
  5239.         if(TheDataAddress != AData) return(1);
  5240.     ToNextItem();
  5241.         if(TheDataAddress != BData) return(2);
  5242.     ToNextItem();
  5243.         if(TheDataAddress != CData) return(3);
  5244.  
  5245.     ToLastItem();
  5246.         if(TheDataAddress != CData) return(4);
  5247.     ToPriorItem();
  5248.         if(TheDataAddress != BData) return(5);
  5249.     ToPriorItem();
  5250.         if(TheDataAddress != AData) return(6);
  5251.     
  5252.     DeleteList(TheList); 
  5253.  
  5254.     PullTheListAndItem();
  5255.  
  5256.     return(False);
  5257. }
  5258.  
  5259. /*------------------------------------------------------------
  5260. | NAME: Test_OutputListOfStrings
  5261. |
  5262. | PURPOSE: To test the 'OutputListOfStrings' procedure.
  5263. |
  5264. | DESCRIPTION: Returns non-zero if error detected.
  5265. |
  5266. | EXAMPLE:  
  5267. |
  5268. | NOTE: 
  5269. |
  5270. | ASSUMES: 
  5271. |
  5272. | HISTORY: 11.22.93 by Lee Malone
  5273. |
  5274. ------------------------------------------------------------*/
  5275. Truth
  5276. Test_OutputListOfStrings()
  5277. {
  5278.     AddressOfList    AList;
  5279.     
  5280.     AList  = MakeSampleListOfStaticStrings();
  5281.  
  5282.     printf("The following list should show three strings,\n");
  5283.     printf("one per line, 'AAAA', 'BBBB', 'CCCC'.\n\n");
  5284.     
  5285.     fprintf(LogFile,"The following list should show three strings,\n");
  5286.     fprintf(LogFile,"one per line: 'AAAA', 'BBBB', 'CCCC'.\n\n");
  5287.     
  5288.     OutputListOfStrings(AList, stdout);
  5289.     OutputListOfStrings(AList, LogFile);
  5290.  
  5291.     ReverseList(AList);
  5292.     
  5293.     printf("And now the same strings in reverse order:\n");
  5294.     fprintf(LogFile,"And now the same strings in reverse order:\n");
  5295.     
  5296.     OutputListOfStrings(AList, stdout);
  5297.     OutputListOfStrings(AList, LogFile);
  5298.  
  5299.     printf("Visually verify the above.\n");
  5300.     fprintf(LogFile,"Visually verify the above.\n");
  5301.     
  5302.     DeleteList(AList); 
  5303.  
  5304.     return(False);
  5305. }
  5306.  
  5307. /*------------------------------------------------------------
  5308. | NAME: Test_OutputListSystemStatus
  5309. |
  5310. | PURPOSE: To test the 'OutputListSystemStatus' procedure.
  5311. |
  5312. | DESCRIPTION: Returns non-zero if error detected.
  5313. |
  5314. | EXAMPLE:  
  5315. |
  5316. | NOTE: 
  5317. |
  5318. | ASSUMES: 
  5319. |
  5320. | HISTORY: 11.22.93 by Lee Malone
  5321. |
  5322. ------------------------------------------------------------*/
  5323. Truth
  5324. Test_OutputListSystemStatus()
  5325. {
  5326.     AddressOfList    AList;
  5327.     
  5328.     PushTheListAndItem();
  5329.     
  5330.     TheList  = MakeSampleListOfStaticStrings();
  5331.     ToFirstItem();
  5332.     
  5333.     printf("\nThe following should show the status of the list system\n");
  5334.     printf("with one list in use and three items in use.\n");
  5335.     
  5336.     fprintf(LogFile,
  5337.         "\nThe following should show the status of the list system\n");
  5338.     fprintf(LogFile,"with one list in use and three items in use.\n");
  5339.     
  5340.     OutputListSystemStatus(stdout);
  5341.     OutputListSystemStatus(LogFile);
  5342.  
  5343.     printf("Visually verify the above.\n");
  5344.     fprintf(LogFile,"Visually verify the above.\n");
  5345.     
  5346.     DeleteList(TheList); 
  5347.  
  5348.     return(False);
  5349. }
  5350.  
  5351. /*------------------------------------------------------------
  5352. | NAME: Test_CleanUpTheListSystem
  5353. |
  5354. | PURPOSE: To test the 'CleanUpTheListSystem' procedure.
  5355. |
  5356. | DESCRIPTION: Returns non-zero if error detected.
  5357. |
  5358. | EXAMPLE:  
  5359. |
  5360. | NOTE: 
  5361. |
  5362. | ASSUMES: State after prior tests.
  5363. |
  5364. | HISTORY: 11.22.93 by Lee Malone
  5365. |
  5366. ------------------------------------------------------------*/
  5367. Truth
  5368. Test_CleanUpTheListSystem()
  5369. {
  5370.     CleanUpTheListSystem();
  5371.     
  5372.         if( TheListSystemIsSetUp )    return(1);
  5373.         if( TheListStackIndex != 0 )  return(2);
  5374.         if( MaxCountOfLists != 0 )    return(3);
  5375.         if( MaxCountOfItems != 0 )    return(4);
  5376.         if( ListSpace != 0 )          return(5);
  5377.         if( ItemSpace != 0 )          return(6);
  5378.         if( CountOfFreeItems != 0 )   return(7);
  5379.         if( CountOfFreeLists != 0 )   return(8);
  5380.         if( FirstFreeList != 0 )      return(9);
  5381.         if( FirstFreeItem != 0 )      return(10);
  5382.         
  5383.     return(False);
  5384. }
  5385.  
  5386.  
  5387. /* Test order is important: later tests depend on earlier ones. */
  5388. TestRecord    ListTestSequence[] =
  5389. {
  5390. /* From 'DataSize.h' */
  5391.     { Test_Byte,                      "DataSize: Byte"           },
  5392.     { Test_Pair,                      "DataSize: Pair"           },
  5393.     { Test_Quad,                      "DataSize: Quad"           },
  5394.     { Test_SignedByte,                "DataSize: SignedByte"     },
  5395.     { Test_SignedPair,                "DataSize: SignedPair"     },
  5396.     { Test_SignedQuad,                "DataSize: SignedQuad"     },
  5397. /* From 'Bytes.c' */
  5398.     { Test_CompareBytes,              "CompareBytes"             },
  5399.     { Test_CopyBytes,                 "CopyBytes"                },
  5400.     { Test_ExchangeBytes,             "ExchangeBytes"            },
  5401.     { Test_FillBytes,                 "FillBytes"                },
  5402.     { Test_IsMatchingBytes,           "IsMatchingBytes"          },
  5403.     { Test_ReplaceBytes,              "ReplaceBytes"             },
  5404. /* From 'Strings.c' */
  5405.     { Test_CountString,               "CountString"              },
  5406.     { Test_CopyString,                "CopyString"               },
  5407.     { Test_AppendString,              "AppendString"             },
  5408.     { Test_AppendStrings,             "AppendStrings"            },
  5409.     { Test_ConvertStringToLowerCase,  "ConvertStringToLowerCase" },
  5410.     { Test_ConvertStringToUpperCase,  "ConvertStringToUpperCase" },
  5411.     { Test_CompareStrings,            "CompareStrings"           },
  5412.     { Test_FindLastByteInString,      "FindLastByteInString"     },
  5413.     { Test_InsertString,              "InsertString"             },
  5414.     { Test_ReplaceByteInString,       "ReplaceByteInString"      },
  5415. /* From 'ListList.c' */
  5416.     { Test_GetNextItem,               "GetNextItem"              },
  5417.     { Test_PutNextItem,               "PutNextItem"              },
  5418.     { Test_TheNextItem,               "TheNextItem"              },
  5419.     { Test_GetPriorItem,              "GetPriorItem"             },
  5420.     { Test_PutPriorItem,              "PutPriorItem"             },
  5421.     { Test_ThePriorItem,              "ThePriorItem"             },
  5422.     { Test_GetItemDataAddress,        "GetItemDataAddress"       },
  5423.     { Test_PutItemDataAddress,        "PutItemDataAddress"       },
  5424.     { Test_TheDataAddress,            "TheDataAddress"           },
  5425.     { Test_GetItemMark,               "GetItemMark"              },
  5426.     { Test_PutItemMark,               "PutItemMark"              },
  5427.     { Test_TheItemMark,               "TheItemMark"              },
  5428.     { Test_GetFirstItemOfList,        "GetFirstItemOfList"       },
  5429.     { Test_PutFirstItemOfList,        "PutFirstItemOfList"       },
  5430.     { Test_TheFirstItem,              "TheFirstItem"             },
  5431.     { Test_GetLastItemOfList,         "GetLastItemOfList"        },
  5432.     { Test_PutLastItemOfList,         "PutLastItemOfList"        },
  5433.     { Test_TheLastItem,               "TheLastItem"              },
  5434.     { Test_GetListItemCount,          "GetListItemCount"         },
  5435.     { Test_PutListItemCount,          "PutListItemCount"         },
  5436.     { Test_TheItemCount,              "TheItemCount"             },
  5437.     { Test_GetListMark,               "GetListMark"              },
  5438.     { Test_PutListMark,               "PutListMark"              },
  5439.     { Test_TheListMark,               "TheListMark"              },
  5440.     { Test_MarkItem,                  "MarkItem"                 },
  5441.     { Test_UnMarkItem,                "UnMarkItem"               },
  5442.     { Test_IsItemMarked,              "IsItemMarked"             },
  5443.     { Test_MarkList,                  "MarkList"                 },
  5444.     { Test_UnMarkList,                "UnMarkList"               },
  5445.     { Test_IsListMarked,              "IsListMarked"             },
  5446.     { Test_MarkItemAsFirst,           "MarkItemAsFirst"          },
  5447.     { Test_IsItemFirst,               "IsItemFirst"              },
  5448.     { Test_MarkItemAsLast,            "MarkItemAsLast"           },
  5449.     { Test_IsItemLast,                "IsItemLast"               },
  5450.     { Test_IsItemAlone,               "IsItemAlone"              },
  5451.     { Test_ToNextItem,                "ToNextItem"               },
  5452.     { Test_ToPriorItem,               "ToPriorItem"              },
  5453.     { Test_ToFirstItem,               "ToFirstItem"              },
  5454.     { Test_ToLastItem,                "ToLastItem"               },
  5455.     { Test_SetUpTheListSystem,        "SetUpTheListSystem"       },
  5456.     { Test_PushTheItem,               "PushTheItem"              },
  5457.     { Test_PullTheItem,               "PullTheItem"              },
  5458.     { Test_PushTheList,               "PushTheList"              },
  5459.     { Test_PullTheList,               "PullTheList"              },
  5460.     { Test_PushTheListAndItem,        "PushTheListAndItem"       },
  5461.     { Test_PullTheListAndItem,        "PullTheListAndItem"       },
  5462.     { Test_MarkListAsEmpty,           "MarkListAsEmpty"          },
  5463.     { Test_IsAnyItemsInList,          "IsAnyItemsInList"         },
  5464.     { Test_IsItemCreationPossible,    "IsItemCreationPossible"   },
  5465.     { Test_IsListCreationPossible,    "IsListCreationPossible"   },
  5466.     { Test_CreateItem,                "CreateItem"               },
  5467.     { Test_DeleteItem,                "DeleteItem"               },
  5468.     { Test_CreateItemForData,         "CreateItemForData"        },
  5469.     { Test_CreateList,                "CreateList"               },
  5470.     { Test_CreateList,                "CreateList"               },
  5471.     { Test_AddToListItemCount,        "AddToListItemCount"       },
  5472.     { Test_InsertItemLastInList,      "InsertItemLastInList"     },
  5473.     { Test_InsertDataLastInList,      "InsertDataLastInList"     },
  5474.     { Test_ExtractTheItem,            "ExtractTheItem"           },
  5475.     { Test_ExtractItemFromList,       "ExtractItemFromList"      },
  5476.     { Test_DeleteList,                "DeleteList"               },
  5477.     { Test_DeleteListOfDynamicData,   "DeleteListOfDynamicData"  },
  5478.     { Test_FindFirstItemLinkedToData, "FindFirstItemLinkedToData"    },
  5479.     { Test_DeleteFirstReferenceToData, "DeleteFirstReferenceToData"  },
  5480.     { Test_DeleteAllReferencesToData, "DeleteAllReferencesToData"    },
  5481.     { Test_IsTheDataMatching,         "IsTheDataMatching"        },
  5482.     { Test_FindFirstMatchingItem,     "FindFirstMatchingItem"    },
  5483.     { Test_FindNextMatchingItem,      "FindNextMatchingItem"     },
  5484.     { Test_FindFirstMarkedItem,       "FindFirstMarkedItem"      },
  5485.     { Test_FindFirstUnMarkedItem,     "FindFirstUnMarkedItem"    },
  5486.     { Test_UnMarkAllItemsInList,      "UnMarkAllItemsInList"     },
  5487.     { Test_FindIndexOfFirstMarkedItem, "FindIndexOfFirstMarkedItem"  },
  5488.     { Test_ExtractMarkedItems,        "ExtractMarkedItems"       },
  5489.     { Test_DeleteMarkedItems,         "DeleteMarkedItems"        },
  5490.     { Test_IsAnyItemMarkedInList,     "IsAnyItemMarkedInList"    },
  5491.     { Test_DuplicateList,             "DuplicateList"            },
  5492.     { Test_DuplicateMarkedItems,      "DuplicateMarkedItems"     },
  5493.     { Test_ExtractFirstItemFromList,  "ExtractFirstItemFromList" },
  5494.     { Test_ExtractLastItemFromList,   "ExtractLastItemFromList"  },
  5495.     { Test_ReverseList,               "ReverseList"              },
  5496.     { Test_JoinLists,                 "JoinLists"                },
  5497.     { Test_ExchangeItems,             "ExchangeItems"            },
  5498.     { Test_InsertItemFirstInList,     "InsertItemFirstInList"    },
  5499.     { Test_InsertItemAfterItemInList, "InsertItemAfterItemInList"    },
  5500.     { Test_InsertItemBeforeItemInList,  "InsertItemBeforeItemInList" },
  5501.     { Test_InsertDataFirstInList,     "InsertDataFirstInList"    },
  5502.     { Test_InsertDataAfterItemInList, "InsertDataAfterItemInList"    },
  5503.     { Test_InsertDataBeforeItemInList,  "InsertDataBeforeItemInList" },
  5504.     { Test_BuildDirectAccessTableForList,  "BuildDirectAccessTableForList" },
  5505.     { Test_FindPlaceInOrderedList,    "FindPlaceInOrderedList"   },
  5506.     { Test_InsertDataInOrderedList,   "InsertDataInOrderedList"  },
  5507.     { Test_FindPlaceInOrderedDirectAccessTable, "FindPlaceInOrderedDirectAccessTable" },
  5508.     { Test_ReorderListToMatchDirectAccessTable, "ReorderListToMatchDirectAccessTable" },
  5509.     { Test_SortShortList,             "SortShortList"            },
  5510.     { Test_SortDirectAccessTable,     "SortDirectAccessTable"    },
  5511.     { Test_SortListViaDirectAccessTable, "SortListViaDirectAccessTable" },
  5512.     { Test_SortList,                    "SortList"               },
  5513.     { Test_SortListAlphabetically,    "SortListAlphabetically"   },
  5514.     { Test_SortListDescending,        "SortListDescending"       },
  5515.     { Test_OutputListOfStrings,       "OutputListOfStrings"      },
  5516.     { Test_OutputListSystemStatus,    "OutputListSystemStatus"   },
  5517.     { Test_CleanUpTheListSystem,      "CleanUpTheListSystem"     }
  5518. };
  5519.  
  5520. /*------------------------------------------------------------
  5521. | NAME: RunTestSequence
  5522. |
  5523. | PURPOSE: To run the tests in the given table.
  5524. |
  5525. | DESCRIPTION: 
  5526. |
  5527. | EXAMPLE:  
  5528. |
  5529. | NOTE: 
  5530. |
  5531. | ASSUMES: 'LogFile' is open for writing.
  5532. |
  5533. | HISTORY: 11.06.93 by Lee Malone
  5534. |
  5535. ------------------------------------------------------------*/
  5536. Nothing
  5537. RunTestSequence(AddressOfTestRecord Tests, Quad CountOfTests )
  5538. {
  5539.     Truth            TestResult;
  5540.     AddressOfString  ProcedureName;
  5541.     Quad            i;
  5542.     
  5543.     for( i = 0; i < CountOfTests; i++ )
  5544.     {
  5545.         ProcedureName = Tests[i].NameOfProcedure;
  5546.         
  5547.         printf("[%ld] Testing: %s\n",i+1,ProcedureName);
  5548.         fprintf(LogFile,"[%ld] Testing: %s\n",i+1,ProcedureName);
  5549.  
  5550.         TestResult = (*Tests[i].TestProcedure)();
  5551.         
  5552.         if(TestResult) /* if there was an error */
  5553.         {
  5554.             printf("...FAILED in section # %d.\n\n",TestResult);
  5555.             fprintf(LogFile,"...FAILED in section # %d.\n\n",TestResult);
  5556.  
  5557.             printf("*********************************************\n");
  5558.             printf("*       F A I L U R E   D E T E C T E D     *\n");
  5559.             printf("*                                           *\n");
  5560.             printf("*      Repair above item and repeat test.   *\n");
  5561.             printf("*                                           *\n");
  5562.             printf("*********************************************\n");
  5563.     
  5564.             fprintf(LogFile,"*********************************************\n");
  5565.             fprintf(LogFile,"*       F A I L U R E   D E T E C T E D     *\n");
  5566.             fprintf(LogFile,"*                                           *\n");
  5567.             fprintf(LogFile,"*      Repair above item and repeat test.   *\n");
  5568.             fprintf(LogFile,"*                                           *\n");
  5569.             fprintf(LogFile,"*********************************************\n");
  5570.  
  5571.             fclose(LogFile);
  5572.             exit(1);
  5573.         }
  5574.         else /* no error. */
  5575.         {
  5576.             printf("...OK.\n\n");
  5577.             fprintf(LogFile,"...OK.\n\n");
  5578.         }
  5579.         if(MaxCountOfItems-CountOfFreeItems) 
  5580.             fprintf(LogFile,"ItemsInUse: %ld",(MaxCountOfItems-CountOfFreeItems));
  5581.     }
  5582. }
  5583.  
  5584. /*------------------------------------------------------------
  5585. | NAME: ListListDemonstration
  5586. |
  5587. | PURPOSE: To demonstrate some 'ListList' functions.
  5588. |
  5589. | DESCRIPTION:
  5590. |
  5591. | EXAMPLE:  
  5592. |
  5593. | NOTE: 
  5594. |
  5595. | ASSUMES: 
  5596. |
  5597. | HISTORY: 11.22.93 by Lee Malone
  5598. |
  5599. ------------------------------------------------------------*/
  5600. Nothing
  5601. ListListDemonstration()
  5602. {
  5603.     AddressOfList AList;
  5604.     AddressOfItem AnItem;
  5605.     AddressOfByte SomeData;
  5606.     AddressOfByte SearchKey;
  5607.     Pair          KeyFieldOffset;
  5608.     Pair          KeyFieldWidth;
  5609.  
  5610.      /* These are the data elements to be itemized. */
  5611.     Byte    John[]   = "John Galt";
  5612.     Byte    Dagny[]  = "Dagny Taggart";
  5613.     Byte    Hank[]   = "Hank Reardon";
  5614.     Byte    Frisco[] = "Francisco d'Anconia";
  5615.     Byte    Hugh[]   = "Hugh Akston";
  5616.  
  5617.     printf("Set up the list system:\n");
  5618.     fprintf(LogFile,"Set up the list system:\n");
  5619.     SetUpTheListSystem((Quad) 30, (Quad) 100);
  5620.     OutputListSystemStatus(stdout);
  5621.     OutputListSystemStatus(LogFile);
  5622.  
  5623.     
  5624.     printf("\nCreate a list of five names:\n");
  5625.     fprintf(LogFile,"\nCreate a list of five names:\n");
  5626.  
  5627.      AList = CreateList();
  5628.      
  5629.     InsertDataLastInList( AList, John   );
  5630.     InsertDataLastInList( AList, Dagny  );
  5631.     InsertDataLastInList( AList, Hank   );
  5632.     InsertDataLastInList( AList, Frisco );
  5633.     InsertDataLastInList( AList, Hugh   );
  5634.  
  5635.     OutputListOfStrings(AList,stdout);
  5636.     OutputListOfStrings(AList,LogFile);
  5637.  
  5638.     printf("Reverse the list:\n");
  5639.     fprintf(LogFile,"Reverse the list:\n");
  5640.     ReverseList(AList);
  5641.     OutputListOfStrings(AList,stdout);
  5642.     OutputListOfStrings(AList,LogFile);
  5643.  
  5644.     printf("Sort the list alphabetically:\n");
  5645.     fprintf(LogFile,"Sort the list alphabetically:\n");
  5646.     SortListAlphabetically(AList);
  5647.     OutputListOfStrings(AList,stdout);
  5648.     OutputListOfStrings(AList,LogFile);
  5649.  
  5650.     printf("Find and print the name starting with 'John':\n");
  5651.     fprintf(LogFile,"Find and print the name starting with 'John':\n");
  5652.     
  5653.     SearchKey = (AddressOfByte) "John";
  5654.     KeyFieldOffset = 0;
  5655.     KeyFieldWidth = 4;
  5656.     
  5657.     AnItem = FindFirstMatchingItem(AList,
  5658.                                    KeyFieldOffset,
  5659.                                    KeyFieldWidth,
  5660.                                    SearchKey);
  5661.     
  5662.     SomeData = GetItemDataAddress(AnItem);
  5663.     
  5664.     printf("%s\n\n",(AddressOfString) SomeData);
  5665.     fprintf(LogFile,"%s\n\n",(AddressOfString) SomeData);
  5666.  
  5667.     DeleteList(AList); 
  5668.  
  5669.     printf("Clean up the list system:\n");
  5670.     fprintf(LogFile,"Clean up the list system:\n");
  5671.     CleanUpTheListSystem();
  5672.     OutputListSystemStatus(stdout);
  5673.     OutputListSystemStatus(LogFile);
  5674. }
  5675.  
  5676. /*------------------------------------------------------------
  5677. | NAME: main
  5678. |
  5679. | PURPOSE: To test list functions.
  5680. |
  5681. | DESCRIPTION:
  5682. |
  5683. | EXAMPLE:  
  5684. |
  5685. | NOTE: 
  5686. |
  5687. | ASSUMES: Room exists for the log file on disk.
  5688. |
  5689. | HISTORY: 01.09.88 by Lee Malone
  5690. |          11.08.93 extended
  5691. |
  5692. ------------------------------------------------------------*/
  5693. Nothing
  5694. main()
  5695. {
  5696.     Quad    CountOfTests;
  5697.     
  5698.     printf("*********************************************\n");
  5699.     printf("*  B E G I N   L I S T L I S T   T E S T S  *\n");
  5700.     printf("*********************************************\n");
  5701.     
  5702.     LogFile    = fopen("ListTest.txt", "w+");
  5703.     
  5704.     fprintf(LogFile,"*********************************************\n");
  5705.     fprintf(LogFile,"*  B E G I N   L I S T L I S T   T E S T S  *\n");
  5706.     fprintf(LogFile,"*********************************************\n");
  5707.  
  5708.     /*
  5709.      * Test the list system procedures.
  5710.      */
  5711.     CountOfTests = sizeof(ListTestSequence)/sizeof(TestRecord);
  5712.     RunTestSequence(ListTestSequence, CountOfTests);
  5713.  
  5714.     printf("***************************************************\n");
  5715.     printf("*   A L L   T E S T S   C O M P L E T E D   O K   *\n");
  5716.     printf("*                                                 *\n");
  5717.     printf("*           'ListList' is ready to use.           *\n");
  5718.     printf("*                                                 *\n");
  5719.     printf("***************************************************\n\n");
  5720.     
  5721.     fprintf(LogFile,"***************************************************\n");
  5722.     fprintf(LogFile,"*   A L L   T E S T S   C O M P L E T E D   O K   *\n");
  5723.     fprintf(LogFile,"*                                                 *\n");
  5724.     fprintf(LogFile,"*           'ListList' is ready to use.           *\n");
  5725.     fprintf(LogFile,"*                                                 *\n");
  5726.     fprintf(LogFile,"***************************************************\n\n");
  5727.  
  5728.     printf("*********************************************\n");
  5729.     printf("*   B E G I N   L I S T L I S T   D E M O   *\n");
  5730.     printf("*********************************************\n");
  5731.     
  5732.     fprintf(LogFile,"*********************************************\n");
  5733.     fprintf(LogFile,"*   B E G I N   L I S T L I S T   D E M O   *\n");
  5734.     fprintf(LogFile,"*********************************************\n");
  5735.     
  5736.     ListListDemonstration();
  5737.     
  5738.     printf("*********************************************\n");
  5739.     printf("*     E N D   L I S T L I S T   D E M O     *\n");
  5740.     printf("*********************************************\n");
  5741.     
  5742.     fprintf(LogFile,"*********************************************\n");
  5743.     fprintf(LogFile,"*     E N D   L I S T L I S T   D E M O     *\n");
  5744.     fprintf(LogFile,"*********************************************\n");
  5745.     
  5746.     fclose(LogFile);
  5747. }
  5748.  
  5749.